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 How to Make a Website Styling Web Pages and Navigation Make a CSS Image Gallery

Juanyan Li
Juanyan Li
1,672 Points

About the "float" setting stuff.

In the video Nick said the footer will float because it is told to do so. But float property is set under the selected #gallery, which seems to me will not affect the footer that stays outside the un-ordered list..

1 Answer

Thomas Seelbinder
PLUS
Thomas Seelbinder
Courses Plus Student 1,223 Points

In the footer, you are actually clearing it, so that it stays below the floated gallery.

clear: both;
      footer {

  font-size: 0.75em;
  text-align: center;
  clear: both; 
  padding: 50px;
  color: #ccc;
}
Juanyan Li
Juanyan Li
1,672 Points

I wonder why the footer will float if I DO NOT clear it. The float property has only been set in the selected #gallery. Why it will appear in the footer so that I have to clear it.

George Offley
George Offley
Courses Plus Student 7,386 Points

When you float something yo are actually taking it outside the flow of the document object model, that's why the clear is needed to be able to reintegrate it. If you don't clear it, it will screw up your document flow.