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 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.

jobbol
seal-mask
.a{fill-rule:evenodd;}techdegree
jobbol
Full Stack JavaScript Techdegree Student 17,885 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?

jobbol
seal-mask
.a{fill-rule:evenodd;}techdegree
jobbol
Full Stack JavaScript Techdegree Student 17,885 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.