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 trialabdirahman liban
Courses Plus Student 2,163 Pointsabout vertical margin collapse
why i have to put top margin of (h1) =0 instead i can put padding = 1em 0; for the (h1)?
2 Answers
David Bilson
13,819 Pointsabdirahman
Adding padding to your h1 element will not solve your vertical margin collapse issue, because padding will be added within the h1 element and therefore will not affect the margins.
See my quick screencast, that i created with Jing, that tries to explain it for you.
http://screencast.com/t/VzEbPFeu
Hope this helps explain it for you.
Morten Larsen
12,275 PointsMorten Larsen
12,275 PointsGreat reply. Thank you very much. Helped me a ton.
Keith Carrillo
6,909 PointsKeith Carrillo
6,909 PointsCould you tell me why does a border wrap around margin after they collapse, instead of a the margin sticking to the outside of a border..