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 Basics (2014) Basic Layout Floats

margin for resorts div??

after he floats the tips div to the right he mentions the margin for the resort div. how does it have margin if we never set a margin for it?

2 Answers

Steven Parker
Steven Parker
229,732 Points

He says "resorts div", but if you look at what is being done in the dev tools, it is the secondary-content div that is being selected and its margin being highlighted. The secondary-content has a margin setting of "auto" applied in the CSS.

Have the same question here... I think what's happening is, when he styles the resorts div with width: 46.5%, the width property only applies to the content, padding and border of the styled element. Because divs are a block-level elements by default, it's making up for the remaining space with the margin that we can see on the right?