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 trialRoarke Van Brunt
1,764 PointsI was wondering if you could explain the bug that caused the error and why the clear: both; line fixes the error
I was just looking for a little more clarification on why this bug pops up and why that line of code fixes it.
4 Answers
Charles Gray
19,470 Pointsif you don't use a clear both after a floated item, everything after it follows the float rule.
James Alker
8,554 PointsBasically 'float' removes the element from the normal document flow, thus allowing elements after it to flow around it. Adding the 'clear' property pushes all following elements down below the floated object.
hoppy bouasavanh
Courses Plus Student 1,791 Pointsas i saw float applied only for "header" and "gallery", i wonder how 'float' concerns the element that is not a child of float.
Charles Gray
19,470 Pointsif one item is floated other items ignore it and acts like that floated item isn't there. So it could affect the rest of the website if it's not cleared.