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!
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
Tomasz Grabarczyk
4,860 PointsHelp with Media Queries
Hey I have problem with media queries, I have done everything correctly on my website as I was following videos. I checked website on android and it doesn't display as it is suppose to. Although when I resize the browser, it does change the website.
Here's what I have:
<link rel="stylesheet" type="text/css" href="main.css" />
Media queries are at the bottom of main css file as they are suppose to be.
@media only screen and (min-width: 768px) and (max-width: 959px) { }
Any Ideas?
Here's my website: www.cheaptranslations.co.uk
3 Answers

Guil Hernandez
Treehouse TeacherIt looks like you're missing your viewport meta tag: <meta name="viewport" content="width=device-width">

Tomasz Grabarczyk
4,860 PointsHey
content="width=device-width"
Is there something like max-device-width? I want to target all screen sizes up to about 800px
and if so? how do I write it?

Chase Lee
29,275 PointsTake out only
.

Chase Lee
29,275 PointsBut it looks like your media queries work.

Guil Hernandez
Treehouse TeacherHi Chase,
only
should still work –– I use it because it's useful for preventing older browsers that don't support media queries from applying all the styles.

Tomasz Grabarczyk
4,860 PointsI got it working! Thank you all :) meta tag for viewport was the only problem
Thanks again!

Guil Hernandez
Treehouse TeacherGlad to hear, Tomasz Grabarczyk!
Tomasz Grabarczyk
4,860 PointsTomasz Grabarczyk
4,860 PointsIn this example, I use min-width 768 px, but I have media queries for all widths specified.