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

why when give margin to .name moves together with .main-nav

hello ,

why when give margin to .name moves together with .main-nav, it should be move just the .name

thanks

i think it is due to the collapsing margins... check MDN for more info.

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing

1 Answer

Kyle Burns
Kyle Burns
4,300 Points

If you are trying to move .name in relation to .main-nav you can adjust the padding. This create space between the .name and the .main-nav but will not cause the .main-nav container to appear to be moving. This is a simple way to create space around your content in relationship to the container it is in. I think this is what your looking for and hope it helps.