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
Y B
14,136 PointsMedia query syntax
I'm stuck in the ow to build a website challenge on responsive design. It asks: "Create a breakpoint for devices 480 pixels wide or larger. Inside the breakpoint, set the body background to the color navy."
@media (min-width: 480px) {
background-color: navy;
}
However the above isn't recognized for some reason. The syntax highlighting isn't working for background-color which makes me think I have the media query syntax wrong somehow?
1 Answer
Jeff Lemay
14,268 PointsYour media query looks correct but you haven't set the background color to any element. You need to add a selector for the body tag before you set the background-color property.
@media (min-width: 480px) {
body {
background-color: navy;
}
}
Y B
14,136 PointsY B
14,136 PointsThanks that fixed- just not used to using @media that I forgot about the selector.
Thanks.