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
Jan Andraczko
3,582 PointsMedia Queries (all type)
Hi,
I am just going through Media Queries video of Guil Hernandez and one thing is confusing for me.
Media query have default type as 'all' which apply to all devices and can be omitted from the declaration.
When I put that after the media declaration it won't work but if I delete, it does.
Any ideas as I believe it should also work without deleting it?
Below my working query: @media (max-width: 960px) { body { background: royalblue; } p { color: white; } }
And not working: @media all (max-width: 960px) { body { background: royalblue; } p { color: white; } }
2 Answers
Daniel Gauthier
15,000 PointsHey Jan,
You're forgetting the 'and' between all and the opening bracket of the media query.
The following code would work:
@media all and (max-width: 960px) { body { background: royalblue; } p { color: white; } }
Or this if you fanned it out:
@media all and (max-width: 960px) {
body {
background: royalblue;
}
p {
color: white;
}
}
Good luck with the course!
Jan Andraczko
3,582 PointsHi Daniel,
Thank you.
Thank you for your answer. It wasn't 100% clear on the video tutorial.
Jan