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 CSS Layout Techniques Display Modes Block vs. Inline Elements

Kai-Ting Lin
Kai-Ting Lin
5,712 Points

Margin collapsing issue: add padding at .main-wrapper?

Margin collapsing happens in this scenario because thereโ€™s no border, padding, content, or anything to separate the top margin of our block level body element with the top margin of its first child. In this case, the first child of the body element should be .main-wrapper, so I just add .main-wrapper padding 20px, instead of .main-header Why it doesn't work. It pushes the header further down and have more gap of 44px instead.

Sean T. Unwin
Sean T. Unwin
28,690 Points

Can you post your code, please.

If you need help with that, see the thread: https://teamtreehouse.com/forum/posting-code-to-the-forum