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

Media Query Code Challenge Not working

The media query code challenge is asking me to write two media queries in CSS. When I write the first query, I get the "Bummer" message if I write it like this:

@media screen and (min-width: 480px){
  h1{
    font-size:2.5em;
  }
}

But if I leave off the closing the curly braces (both of them), the challenge completes and moves on to the next task. However, the problem repeats itself, and leaving off the closing curly braces doesn't work at that point. I emailed Support and they said things are working as they should, so any ideas?

Hi Michael! Can you specify how named this challenge and course?

The course is How to Make a Website. It's the Write CSS Media Queries code challenge.

This code

@media screen and (min-width:480px){
  h1{
    font-size:2.5em;
  }
}

works fine by me. Did you wrote this css rule at the end of file?

2 Answers

Steven Parker
Steven Parker
243,656 Points

I also tried your code, just as-is, in the challenge by adding it to the end of the CSS file. The "check work" function said "Well done!".

Just for grins, I tried it again without the last two closing braces. It ALSO said "Well done!". But that's a bug, and you clearly can't get by that way if it's not the last thing in the file.

But I couldn't get a failure either way. Perhaps you had something odd on the line that also got removed when you took away the final braces? The only other suggestion I have is to add a few spaces (but I didn't need this to pass):

@media screen and (min-width:480px) {
  h1 {
    font-size: 2.5em;
  }
}

I also got the "Bummer" notification when typing in the correct code, and a "Well Done" when removing the closing curly braces, similar to Michael Modenbach. Perhaps there's something else in the code that is preventing it from working properly, but I didn't have anything else that would have been erased by deleting the two curly braces. It seems like a bug.