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.

CSS Unused CSS Stages Media Queries Media Features and Media Types

snarlzbarkley
snarlzbarkley
2,964 Points

Stuck on Media Query Challenge #1

I am not able to get passed the first challenge in the media query section of CSS.

The question asks you to, "Create a media query that sets the body element's background color to #FF6347 and its text color to white if the viewport width is 768px or less."

Here is the code I am trying:

@media and screen (max-width: 768px) {
  body {
    background: #FF6347;
    color: white;
  }
}

I have also tried this code using "background-color: #FF6347;" as well as using hex value for the white color (#fff as well as #ffffff) with no success. Can someone spot my error here? Thank you for the help.

1 Answer

nicholas maddren
nicholas maddren
12,793 Points

Here's a clue your missing something here:

@media **** screen *** (max-width: 768px)

Read the question again, if you don't get it I will reveal another clue :)

snarlzbarkley
snarlzbarkley
2,964 Points

Hahaha, thank you! As soon as I saw your post it clicked immediately. I need to learn to stop coding BEFORE my brain is melted and maybe I can avoid some of these simple errors. Thanks again :).