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

Bartlomiej Pajak
Bartlomiej Pajak
5,063 Points

My solution of float challenge

Here is what I wrote it:

/* ---- Columns ---- */

     .secondary {
    width: 40%;
    float: left;
}

  .primary {
    width: 60%;
    float: right;
}

.col {
    padding-right: 1em;
    padding-left: 1em;
}

I saw a little different solution in the video, but finally two approaches look the same. Is it still ok?

Thank you ;)

2 Answers

Steven Parker
Steven Parker
231,172 Points

This is OK, but its not necessary to float to opposite sides if the the items are going to take up the entire width (40% + 60%).

So the video code saves a line by sharing the float property in the common "col" class instead of giving each side a separate one.

Samuel Lebisch
Samuel Lebisch
4,580 Points

Hi Steven, do you play Chess by any chance?

Steven Parker
Steven Parker
231,172 Points

I think I'm still listed in the USCF rankings, but I'm pretty rusty.

Samuel Lebisch
Samuel Lebisch
4,580 Points

No way, I respect that. I might not be that high up in the ranks, but I'm always looking to improve. Maybe we can have a session on chess.com and you can teach me one or two things.