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 trialLeo Marco Corpuz
18,975 PointsUsing .col as a selector instead of .primary-col and .secondary-col
I'm wondering why it wouldn't work to use .primary-col,.secondary-col as selectors to make the columns.I've tried it and nothing works on the paragraphs.
4 Answers
Steven Parker
231,236 PointsIf you're using the code from the video, there aren't any classes named "primary-col" or "secondary-col" used in the HTML.
But you should be able to get the same results using ".primary, .secondary
" as the selector.
Luke Kennedy
11,661 PointsHi Steven,
Thank you for this! I was confuse for a while till you mentioned that we could also produce the same result with '.primary, .secondary'. This was a tricky challenge, helped me remembered that we can actually give 2 names of class to the tags.
So kind of you to help out, I literally see you in almost all the questions posted by other students. haha
Luke.
anthonyv1
8,168 PointsThis is how I went at it :
.primary { width: 50%; display: inline-block; float: left; padding-right: 10px; }
.secondary { width: 50%; display: inline-block; float: right; padding-left: 10px; }
Worked for me. Would there be an unintended consequence I didn't see ?
William Coshburn
6,125 PointsWait, it says "primary col" so why can't I write " .primary col" ?
Steven Parker
231,236 PointsYou need periods before class names in a selector, and no space if they pertain to the same element. So you could write ".primary.col
", but it's excessive specificity (not "best practice").
William Coshburn
6,125 PointsThank you. I didn't realize the space was an issue.
Gabriel Plackey
11,064 PointsGabriel Plackey
11,064 PointsCould you post your code to look at?