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 Basics (2014) Enhancing the Design With CSS Media Query Basics

Lee ChenChih
PLUS
Lee ChenChih
Courses Plus Student 1,285 Points

Why is the second media query not working properly on chrome, but work well on firefox?

Why is the second media query not working properly on chrome, but work well on firefox? IS is unable to turn red on chrome, but is able to turn red on firefox. Why was that. Is there any solution? I htink the video is using chrome, but my chrome can't turn.

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

}

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

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

3 Answers

Lee ChenChih
PLUS
Lee ChenChih
Courses Plus Student 1,285 Points

It's the same, i copy the code and paste. I'm not using mac. The red will not come out, but the green come out.

Lee ChenChih
PLUS
Lee ChenChih
Courses Plus Student 1,285 Points

i tried with my code, it's unable to work properly with the workspace. But I download the folder from workspace, and execute on my local , it will work normally.

Kaung Myat Lwin
Kaung Myat Lwin
1,943 Points
@media screen and (max-width: 960px) {
    body {
        background: royalblue;
    }
}
@media screen and (max-width: 480px) {
    body {
        background: red;
    }
}
@media screen and (min-width: 481px) and (max-width: 700px) {
    body {
        background: seagreen;
    }
    p {
        color: white;
    }
}

This should run fine. You missed screen and in the media queries. Try it. :)