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

CSS

Help 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

In this example, I use min-width 768 px, but I have media queries for all widths specified.

3 Answers

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Tomasz Grabarczyk,

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

Hey

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
Chase Lee
29,275 Points

But it looks like your media queries work.

Guil Hernandez
Guil Hernandez
Treehouse Teacher

Hi 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.

I got it working! Thank you all :) meta tag for viewport was the only problem

Thanks again!