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 Basics Page Layout with the Float Property The Float Challenge Solution

Amandeep Pasricha
Amandeep Pasricha
14,932 Points

Why did he apply the float to only the col class and not individually to primary and secondary?

In my solution, I applied a float left property to primary and float right property to secondary. That made more sense to me, because you aren't supposed to apply the float to the specific columns?

If you apply a float: left to col in general, then that would mean both columns would be floated to the left, which isn't what we want. We want one to go on the left and the other to go on the right.

Gabriel Pierce-Lackey
Gabriel Pierce-Lackey
11,014 Points

Yes, most definitely. Beyond these two ways there are even more ways to achieve this. Another that comes to mind quickly being flex box.

You will learn multiple ways to do just about everything, as you get better and more comfortable you will learn what ways are the best for what you are trying to do.

1 Answer

Gabriel Pierce-Lackey
Gabriel Pierce-Lackey
11,014 Points

The float left to both will work in a way where it push the first column to the left, then the second column against that the first one to the left as well. Giving the same result with less code. Which is always good.

Amandeep Pasricha
Amandeep Pasricha
14,932 Points

Gabriel Pierce-Lackey Cool so there's more than one way of doing it essentially?