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
Ryan Schmelter
9,710 PointsHow is the TOP margin of the header colliding with the body. Wouldn't it be the bottom margin?
I'm confused about how the top margin of an element above the body collides with the body. It seems like the bottom margin would collide. Can anyone clarify this?
2 Answers
Steven Parker
243,656 PointsThere aren't any elements above the body.
The body element contains all the other elements (well, except for the html element which contains it).
When you say "collide", I assume you're talking about parent-child margin collapse, which would be likely if the header is the first element inside the body.
Ryan Schmelter
9,710 PointsThank you. You both helped me realize how I was looking at this the wrong way.
Jan Oberreiter
78,021 PointsJan Oberreiter
78,021 Points... that would be your padding ... the margin gets the whole section of the header to move downwards and then it collides with the body, because the size of your header-area stays the same, when changing the margins ... a good escape is always:
box-sizing: border-box;
... if I understood your question right ...