【发布时间】:2014-07-05 00:21:39
【问题描述】:
嘿嘿 我有一个 mvc 页面,其中包含一些适用于 ipad 和移动设备的 css。
ipad(@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) ) 的查询工作正常,但我无法让移动设备的查询正常工作。 我试过这个:
@media only screen and (min-device-width : 320px) and (max-device-width : 480px)
还有这个:
@media only screen and (min-device-width : 320px) and (max-device-width : 767px)
还有这个:
@media only screen and (max-device-width : 767px)
我的元数据是这样的:
<meta name="viewport" content="width=device-width,initial-scale=1" />
在 HTC ONE 和 iphone 4 上测试。
【问题讨论】:
-
Don't include 'max device' make it so your queries look like this @media (max-width: 767px) EDIT: or min-device for that matter
-
尝试使用
@media only screen and (max-width: 767px),不带最大设备宽度一次 -
最大宽度不起作用
标签: css mobile media-queries