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

Joram Livengood
seal-mask
.a{fill-rule:evenodd;}techdegree
Joram Livengood
Full Stack JavaScript Techdegree Student 14,603 Points

Did anyone else use floats?

I set each columns max-width to 48%, so that they weren't touching, and then I floated each one a different direction.

Is this a sustainable solution?

.col { max-width: 48%; }

.primary { float: left; }

.secondary { float: right; }

6 Answers

Brent Palmer
Brent Palmer
8,779 Points

Sure that works, and that should leave you with 2% margin to work with between the columns.

Bartlomiej Zabielski
PLUS
Bartlomiej Zabielski
Courses Plus Student 10,363 Points

yeah i used floats now im confused which way is better. floats seem way easier

Ive changed the class to 1 name, so i could target them sepretly. this is my solution.

.primary-col, .secondary-col{ display:inline-block; width:50%; }

.primary-col{ float:left; padding-right:20px; }

.secondary-col{ float:right; padding-left:20px; }

.col{ width:50%; float:left; display:inline-block; padding: 1em 1em;} worked for me

Jay Dacosta
Jay Dacosta
5,913 Points

thats exactly what i did. i also didnt change the display value though. i did noticed that once resized, the contents of both columns overflowed onto the footer. Corrected by simply adding an "overflow: auto;" to the footer wrap class.

Ivan Poch
Ivan Poch
9,887 Points

I too used float but just with one div. And it work just fine.

.primary-col { display: inline-block; float: left; width: 35%; }

.secondary-col { display: inline-block; width: 35%; margin-left: 10%; }