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 Clearing Floats

in the quiz theres margin and the floated element moved up

theres a task on the quiz that ask you to float an element to the right just like the teacher did in the video but he said it didnt move up because of margin. in the quiz it moved up even though that had margin as well. im confused why one did and one didnt.

1 Answer

Steven Parker
Steven Parker
231,248 Points

Just having a margin won't prevent a float from working, but it will if the total width of the item plus the margin makes it too wide. The point being made is that a margin is never included in a specified size and is always extra.

But in the quiz the element floated right on the margin. Is it because the width was small enough?

Steven Parker
Steven Parker
231,248 Points

Can you show the specific code, or give a time index in the video where it is shown?