Jump to content

Trying CSS media query. Not working


LLLLLLL

Recommended Posts

I'm trying a basic CSS media query. I added these two lines to my file... they are essentially copied from another site, with the href being different and referring to actual files on my server.

 

<link rel="stylesheet" type="text/css" media="screen and (max-width: 740px)" href="assets/css/style_m.css" />

<link rel="stylesheet" type="text/css" media="screen and (min-width: 741px) and (max-width: 900px)" href="assets/css/style.css" />

 

But this doesn't work for me at all. The result on my site is that the elements on the page act as if no CSS file is declared at all. Is there something more that I need to do?

Link to comment
Share on other sites

I don't understand. Can you clarify why it works on one site but not mine?

 

This is all the relevant code:

 

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />

<link rel="stylesheet" type="text/css" media="screen and (max-width: 740px)" href="assets/css/style_m.css" />

<link rel="stylesheet" type="text/css" media="screen and (min-width: 741px) and (max-width: 900px)" href="assets/css/style.css" />

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.