Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Basics (2014) Enhancing the Design With CSS Media Query Basics

RED IS NOT WORKING WITH RIGHT SYNTAX!!

MY blue is displaying but not red, ive checked answeres in previous student questions and seems my syntax is correct, PLEASE HELP!

@media (max-width: 480px) { body { background: darkred; } }

So at first blue was working and now nothing is working. Tried opening it up on internet explorer same issue. Here is my workspace, PLEASE HELP!

https://w.trhou.se/qe0hpgwbe9

5 Answers

Steven Parker
Steven Parker
217,573 Points

Both colors work for me when I fork the snapshot. I only need to adjust the window size to see them (since they are done in media queries that only take effect at certain window widths).

Are you sure your window size was set to meet the media query requirements?

I think its a browser issue in displaying the colors, I went to the next course on media queries and those displayed correctly. Thank you, non the less!

Billy Chui
Billy Chui
6,852 Points

same problem with me. must be the web browser' issue. But then i changed the max-width to 600px instead of 480px and is work.

Thanx for the tip, Billy! thats probably whats was wrong with mine as well but for now I gotta keep on trucking!

Ryan Baeschlin
seal-mask
.a{fill-rule:evenodd;}techdegree
Ryan Baeschlin
Front End Web Development Techdegree Student 9,854 Points

I had the same issue. I was using chrome and installed the window re-sizer add-on that was in the teacher's notes. https://chrome.google.com/webstore/detail/window-resizer/kkelicaakdanhinjdeammmilcgefonfh?hl=en

When I made my browser as small as possible it wouldn't go under 500px, so it would never get to the 480px. Maybe your window isn't getting small enough as well.

I had to go with these values to make it work properly:

@media (max-width: 960px) { body { background: royalblue; } }

@media (max-width: 600px) { body { background: darkred; } }

@media (min-width: 601px) and (max-width: 700px) { body { background: seagreen; } p { color: white; } }

Yeah I think it is a browser issue, I'm using chrome, but wants I increased the with to 600px too, it changed to darkred.

Same problem with me. red does not work with 480px but when I changed 505px in place of 480px it works. I'm using chrome, it might be a browser issue.