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 trialNatalie Nohel
4,422 Points.col not working???
I am having trouble getting the .col class to work but I am able to use the float property to get the two columns, here is what I try to use with the .col class
.col { display: inline-block; width: 50%; background-color: light grey;
}
it does not work that way but does work if I swap display out for float.
2 Answers
Matt Bazley
195 PointsHave you added a negative margin? - This should get the columns displaying side-by-side.
"margin-right: -4px;"
Alexander Acker
18,123 PointsPretty sure Matt's answer should do the trick but would like to call out the CSS tricks article that provides solutions for fixing inline-block element layouts especially when trying to apply summed width of 100%.
https://css-tricks.com/fighting-the-space-between-inline-block-elements/
Benjamin Hedgepeth
5,672 PointsBenjamin Hedgepeth
5,672 PointsPlease post your HTML and CSS in case you made an error somewhere in your document.