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 Write CSS Media Queries

Hi! I'm trying to write the second breakpoint of the responsive web design challenge and i can't seem to get it right.

I typed :

@media screen and (min-width:660px) {
  body {
    background-color: darkgreen;
  }
}

(even tried without the '-color') What am i doing wrong?

4 Answers

Hi Brenda,

Did you close off your previous 480px media query? This media query won't work if the previous one isn't closed off.

Hi Jason,

I did closed the previous media query. Also, I did it again and made sure the code was at the end of everything but it still thinks i did it wrong. I don't get it.

Ok, can you post both media queries? In other words, post all of the css that you have added but not what's already there.

It says: Bummer! Did you change the background color to darkgreen for devices larger than 660px?

And I typed:

@media screen and (min-width:480px) {
  body {
    background-color: navy;
  }
 @media screen and (min-width:660px) {
   body {
     background-color: darkgreen;
   }

Mmmm, it looks all in the same line but it's not. sorry.

Chris Shaw
Chris Shaw
26,676 Points

You haven't closed off your media queries as Jason mentioned earlier, you should have the below.

@media screen and (min-width:480px) {
  body {
    background-color: navy;
  }
}

@media screen and (min-width:660px) {
  body {
    background-color: darkgreen;
  }
}

Oh!! You're right! Now it works. Thank you so much to both of you. :)