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

HTML How to Make a Website Responsive Web Design and Testing Refactor the Layout

CSS

My challenge says to add a width of 28.3333% to a list item inside the gallery for screens that are larger than 480px. Here is my code:

@media screen and (min-width: 480px) {
  #gallery li{
    width: 28.3333%;
  }
}

what is wrong?

3 Answers

Hi Zachary,

There doesn't seem to be anything wrong with your code. I just copied your code and pasted it into the challenge and it passes.

Thanks for the help! It seems as though I typed my code at the tope of the page and it wanted it at the bottom!

You're welcome.

Yes, the cascade still applies with media queries. If you put it at the top then all the css below the media query has a chance to override what is in the media query.

In this case, you were correctly setting the width to 28.3333% but then further down in the css the width is set back to 45%.

So that's why it has to be at the bottom. You want to override the 45% not the other way around.

Colin Marshall
Colin Marshall
32,861 Points

Try putting a space between the "li" and the curly brace.

thanks for the help, it seems as though I typed my coe at the top of the file and it was supposed to be at the bottom!

Colin Marshall
Colin Marshall
32,861 Points

Ahhh that makes sense why it wasn't working!