Min-width and Max-width css media queries

房东的猫 提交于 2019-12-21 02:45:13

问题


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

Shouldn't that line of code do so that the stylesheet "mobile-large.css" be loaded when using a Samsung Galaxy Nexus with 720px in width? However it doesn't so what is the reason and how do I fix it?

I am using this too:

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

回答1:


May be you have to define device-width instead of simple width. Write like this:

<link href="css/mobile-large.css" media="all and (min-device-width: 481px) and (max-device-width: 760px)" rel="stylesheet" type="text/css" />



回答2:


I think also you can remove "all and" from the query string.



来源:https://stackoverflow.com/questions/9513931/min-width-and-max-width-css-media-queries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!