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 trialEmma Cole
8,296 PointsIncorrect background-color?
I am on challenge task 2 of 3 and am being asked to add a media query that changes the background color of the body element to #4682b4 when the screen size is 480px or less.
This is the code I have written:
@media screen and (max-width: 480px) {
body {
background-color: #4682b4;
}
I keep getting an error asking if I have specified the correct background color?
I've tried redoing it several times and I know i must be doing something wrong but I cannot figure it out.
Any hints?
4 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Emma,
Did you close off your previous 768px media query? That would cause this one not to work.
As Dustin mentioned, you should close this one off too. It will still work if it's the last thing in your css but if you add something after it then it won't work. It's good practice to always close them off.
Dustin Matlock
33,856 PointsHey Emma! Looks like you just need to close off the end of your media query with a curly bracket }
.
@media screen and (max-width: 480px) {
body {
background-color: #4682b4;
}
} /* Missing bracket */
Emma Cole
8,296 PointsThanks Dustin,
I've tried that and it still doesn't work. I feel like i'm going mad lol
Dustin Matlock
33,856 PointsPretty common mistake glad you got it.
Emma Cole
8,296 PointsAha Jason, thank you that's cracked it!
Its always the simple things isn't it.
Jason Anello
Courses Plus Student 94,610 PointsYou're welcome.