This course will be retired on July 12, 2021. We recommend "Mobile-First CSS Layout" for up-to-date content.
Why Vertical Margins Collapse3:42 with Guil Hernandez
In this video, you'll learn why vertical margins collapse and how to prevent them from collapsing.
- If there is no content, padding, or border area to interrupt two touching margins, the margins collapse to the largest of the two margin values.
- You may experience margins collapsing in adjacent elements like paragraphs and divs.
- If a div's bottom margin is larger than the top margin of the div below it, the margin area between the divs collapses to the largest of the two margin values.
You need to sign up for Treehouse in order to download course files.Sign up