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 trialJoram Livengood
Full Stack JavaScript Techdegree Student 14,603 PointsDid 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
8,779 PointsSure that works, and that should leave you with 2% margin to work with between the columns.
Bartlomiej Zabielski
Courses Plus Student 10,363 Pointsyeah i used floats now im confused which way is better. floats seem way easier
Patrick Pankn
1,520 PointsIve 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; }
Benson Makoni
8,319 Points.col{ width:50%; float:left; display:inline-block; padding: 1em 1em;} worked for me
Jay Dacosta
5,913 Pointsthats 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
10,560 PointsI 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%; }