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
Gabriel Rosario
23,602 PointsMedia querys
Just want to change styles on mobile devices.
body { background: red; }
@media only screen and (min-device-width:320px) and (max-device-width:480px) {
body { background: blue; }
}
why did not work? Please help!!!
3 Answers
Stephen Roberts
8,580 PointsHi Gabriel I might be wrong but I think you need to remove -device- i.e.
body { background: red; }
@media only screen and (min-width:320px) and (max-width:480px) {
body { background: blue; }
}
Graham Burrows
2,580 PointsHi Gabriel,
As far as I can tel you have written this correctly, however, because you have the instruction 'device' in the code you will only be able to see the changes on your mobile.
To have it work on your laptop/desktop, you need to remove the 'device' from your code, and then try resizing your window.
@media only screen and (min-width:320px) and (max-width:480px)
I hope this helps.
Gabriel Rosario
23,602 PointsThnks a lot!!!