Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.