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

HTML How to Make a Website Styling Web Pages and Navigation Style the Image Captions

Gabriella Toth
Gabriella Toth
2,385 Points

Why does the footer need a clear: both; ?

I don't quite understand why the footer floats in the first place. We have created an id "gallery" and applied it to the <ul> tag, so that the portfolio floats. But I thought that these tag ids are specific to that tag only. The footer is a brand new tag, within which there is no <ul> tag, let alone an id set to "gallery". So how come the footer still floats?

3 Answers

Gabriella Toth
Gabriella Toth
2,385 Points

Thanks Bruce, that is exactly what I was trying to ask, but you worded it so much better. Maybe someone can elaborate?

Gabriella Toth
Gabriella Toth
2,385 Points

Nevermind, answer found! Check CSS Basics course -> Basic Layout section -> Floats & Clear Floats videos!

Thanks, Gabriella. I watched the video. I kind of almost understand how floats and clear work but still don't understand why you need them in the case we asked about. But oh well. Maybe I'll understand someday!

I had a similar questions. Here's the link to the video that Gabriella is referring to: https://teamtreehouse.com/library/css-basics/basic-layout/clearing-floats

Thanks, Diego.