CSS CSS Layout Basics Getting Started with CSS Layout Why Vertical Margins Collapse

Can't make heads or tails of what he's talking about. Is there a way he can point with a ruler at what he is referring?

I don't get anything he's saying because the objects he's referring to are not clear

2 Answers

John Haupenthal
John Haupenthal
2,749 Points

Just came to agree with post. An animated video of the margins or something would help, but there isn't much on the screen when he's breaking down what's happening with Google Dev and I found it difficult to follow.

Josh Olson
Josh Olson
13,113 Points

I thought it made sense. He's pointing at the individual elements inside the page. I guess it may not make sense if the HTML is complex or the structure is unknown. Perhaps it would be best if he simplified it.

In which case maybe a text tutorial could be helpful. https://css-tricks.com/what-you-should-know-about-collapsing-margins/

I see the 21 px now. But I can't find in the code how the <p> elements have a 16px margin?

Josh Olson
Josh Olson
13,113 Points

This is checked from the browser's developer tools. Right click an item on the page and select inspect element. On the sidebar right side lists all the styles used. Scroll down to the bottom and it will give you the box model dimensions with margins, border, padding, and size.

Treehouse also offers a course that looks at the Dev Tools for Chrome.