Quantcast
Channel: Can I have a media query in the document head as well as in the CSS file? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Can I have a media query in the document head as well as in the CSS file?

$
0
0

Is it possible to declare a media query in the head like so:

<link href="css/style-mobile.css" rel="stylesheet" type="text/css" media="all and (max-width: 736px)" />

and then within style-mobile.css to declare another media query, like so:

@media only screen and (min-width: 408px) {   .topnav-masters {       width: 29%;       padding: 13px 2%;   }}

I haven't been able to find an answer to this question, and my initial experimentation seems to make me think that it cannot be done. Has anyone else come across this?

This is a weird use case, and I usually build sites mobile-first, responsively, and don't have this issue. However, in this case, the website already had a separate mobile website and now they want it to just be responsive. I was trying to save time by just including it at the right points, so that I don't have to muck around with merging the huge CSS files together. However, there are a few CSS tweaks I need to make at other screen sizes, and that is why I am trying this.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>