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.

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,662 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. :)