Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

I am trying to add top margin to my footer, it however is inside the same div with the body content. How do I do it?

I have tried to give specific class to the footer but after I put some top-margin to it nothing happened.

thanks Allison. As you said i set the footer display to inline-block and it worked!!!!

Awesome! No problem!

1 Answer

Hi Yonas, Can you include your code here? Makes it a lot easier to see what's going on and whether there are CSS rules that are in conflict with each other/canceling each other out.

Best guess though - it sounds like a margin collapse issue. The top margin of your footer is collapsing into the bottom margin of whatever element precedes it in your markup. There are a few ways to correct this - the easiest would be to try setting the display property of your footer to 'inline-block' and see what happens. Margins of inline-block elements never collapse.