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 Layout Techniques Float Layout Creating a Horizontal Menu

Kai-Ting Lin
Kai-Ting Lin
5,712 Points

Hello, I have a question about "collapse". I can't visualise it well. It comes from the explanation of "main-nav".

Before Gui adds a background white to it and give it float, he explains: "main nav ul element is still in the normal document flow but it appears collapsed at the top of our header, ". What does "collapse" mean in this context?

Thanks !

1 Answer

When all tags inside a tag are set to float, the external tag will act like it's empty, losing it's height, hence the white line he demonstrated. example:

<not floated><floated></floated></not floated>

Imagine the "floated" tag is floating above "not floated." Instead of stretching around and containing "floated," "not floated" won't see it up there and will instead collapse, or act like it's empty. The way they fix it in the video is floating "not floated" up to "floated", so they're both removed from document flow.