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 Unused CSS Stages Media Queries Adaptive Layouts with Media Queries

Matt Caron
Matt Caron
2,212 Points

Need a refresher

Hey I'm stuck trying to understand something:

Why is it that I have to select .col instead of .content? Seems strange because col is preceded by main, secondary, and extra in the HTML.

So it looks like this:

<div class="main col">

1 Answer

Janek Rezner
Janek Rezner
12,973 Points

if you were to select .content you would end up floating the parent of .col elements and not .main, .secondary and .extra themselves (as they are nested inside it).

also by passing 2 words as a class you are giving 2 autonomous classes to one element (you can give multiple classes to one tag but only one id).

So this code -

@media screen and (min-width: 481px) {
    .col {
        float: left;
    }
}

is exactly the as this -

@media screen and (min-width: 481px) {
    .main, .secondary, .extra {
        float: left;
    }
}

and they both let you pass the challenge.

but this:

<div class="main col">

is one div with two classes

1) .main

2) .col