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 CSS Layout Techniques Display Modes Column Layout with Inline-Block

Jason Mc Dermott
Jason Mc Dermott
11,496 Points

After adding the media queries to make the columns stack they still wouldn't stack for me.

I followed everything to the letter and have proof read my code and I still can't figure out why the columns won't stack on the smaller screen sizes.

.col { height: 100%; }

.col { display: inline-block; padding: 20px; margin-right: -5px; vertical-align: top; }

.primary-content { width: 60%; }

.secondary-content { width: 40%; }

media queries

@media (max-width:768px) {

.main-logo,
.main-nav,
.main-nav li,
.col {
    display: block;
    width: initial;
    height: initial;
    margin: initial; }

Any feed back would be appreciated. I'll try look around in the meantime and find a similar example or a work around, but this looks like it should be very straight forward and was explained well in the video, Thanks again.

James Mejia
James Mejia
7,726 Points

Can you post the whole media query block? It looks like you're missing the closing '}' on the media query.

4 Answers

Wigger Tolsma
Wigger Tolsma
997 Points

I've got the same problem. You basically wanna just set the width of .secondary-content and .primary-content to 100% in the query, and itll work just fine!

Jamie Alderson
Jamie Alderson
8,412 Points

have you tried clear:right; on .primary-content ?

Jason Mc Dermott
Jason Mc Dermott
11,496 Points

I have tried that Jamie but unfortunately it hasn't worked. I'll just go back and do the lesson again, no biggie. I'd appreciate any feedback meantime. Thanks again.

Here is the media queries block

@media (max-width:758px) {

.main-logo,
.main-nav,
.main-nav li,
.col {
    display: block;
    width: initial;
    height: initial;
    margin: initial; }

.main-nav {

    padding-left: initial;
}
.main-nav li {

    margin-top: 15px;

    }


    .main-banner {
        display: none; 
    }

}

and for the columns

.col { display: inline-block; padding: 20px; margin-right: -5px; vertical-align: top; }

.primary-content { width: 60%;

}

.secondary-content { width: 40%;

}