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

Deborah Savage
seal-mask
.a{fill-rule:evenodd;}techdegree
Deborah Savage
Front End Web Development Techdegree Student 6,794 Points

These media queries did not apply and I've double checked my syntax and spelling, Im not sure if something is overriding

These media queries did not apply and I've double checked my syntax and spelling, Im not sure if something else is overriding them, however, i'm not seeing the problem. I could use some help please.

Can you post your code?

Deborah Savage
seal-mask
.a{fill-rule:evenodd;}techdegree
Deborah Savage
Front End Web Development Techdegree Student 6,794 Points

''' /* media qeries -------------------- */

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

}

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

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

}'''

To share a workspace you will need to make a snapshot. Click the camera icon in the upper right corner. then 'Take Snapshot' and post the link that is created here.

6 Answers

Heidi Fryzell
seal-mask
MOD
.a{fill-rule:evenodd;}techdegree seal-36
Heidi Fryzell
Front End Web Development Treehouse Moderator 25,178 Points

Hi Deborah,

I am not sure if I am seeing all your code but I think the problem could be you don't have all the closing brackets you need. This is what I think you are trying to to do:

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

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

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

I added in a couple "}" that were missing. I hope this helps.

Heidi

Monica Dumitrescu
Monica Dumitrescu
1,490 Points

Hi! In my case the browsers ignores the second media query, the one with the darkred background. I just copied Heidi Fryzell's code, which seems correct, but I still can't see the transition to the red background.

I also had this problem and I think the problem is you have to small of a screen so you should change the pixels to a larger amount. I changed mine to 580px and if this does not work I don't think I can help.

this helped me. Thank you

The only way I could get this to work was to look it up and use this instead:

@media screen and (max-width: 960px) { body { background: royalblue; } p { color: white; } }

adding "screen and" made everything work just fine.

This worked for me!

Thanks!

I had to remove "all" for this to work.