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 How to Make a Website Styling Web Pages and Navigation Style the Portfolio

Sam Purcell
Sam Purcell
2,121 Points

Why do we float the header left?

I understand the concept of a float, but I am not really understanding what the purpose of using a float: left for the entire header, what exactly is that accomplishing?

When I remove it from the code it doesn't seem to have an effect.

Thanks for your help!

2 Answers

Well if you wanted to add something else to the header like a piece of text for the location and phone number. You can float it to the right. Allowing for both pieces of information to be aligned in the header. Otherwise, the new text would appear most likely underneath the current header if the size was bigger then the header's width dimensions.

Satnam Singh
Satnam Singh
7,194 Points

Well the best solution is to not use those float codes and other properties, this code will fix all those issues with just 1 property, here's the code you can try instead of that float and other codes :

header {
    overflow: hidden;
}