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 trialZachary Hutchins
1,567 PointsCSS
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
Jason Anello
Courses Plus Student 94,610 PointsHi 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.
Colin Marshall
32,861 PointsTry putting a space between the "li" and the curly brace.
Zachary Hutchins
1,567 Pointsthanks 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
32,861 PointsAhhh that makes sense why it wasn't working!
Zachary Hutchins
1,567 PointsZachary Hutchins
1,567 PointsThanks for the help! It seems as though I typed my code at the tope of the page and it wanted it at the bottom!
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsYou'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.