【发布时间】:2013-02-22 22:45:20
【问题描述】:
我对媒体查询领域非常陌生,很明显,除了它们明显的定位能力之外,我还缺少关于宽度和设备宽度之间差异的一些基本信息。
我想针对具有相同断点的常规计算机和设备,所以我只是将所有最小和最大宽度查询复制到最小设备和最大设备宽度查询。无论出于何种原因,当我添加 -device 对应项时,普通计算机对我的 CSS 的解释非常不同,我不确定我做错了什么。
You can see the effects here(应该是这个样子)
And here(在我的查询中添加 -device-width 后,我的 CSS 在最小宽度处搞砸了——即使浏览器宽度小于所调用的宽度,也会看到更大的分辨率)。
这是我的 CSS 链接——我的语法有问题吗? :
<link rel="stylesheet" media="only screen and (max-width: 674px), only screen and (max-device-width: 674px)" href="300.css">
<link rel="stylesheet" media="only screen and (min-width: 675px) and (max-width: 914px), only screen and (min-device-width: 675px) and (max-device-width: 914px)" href="650.css">
<link rel="stylesheet" media="only screen and (min-width: 915px) and (max-width: 1019px), only screen and (min-device-width: 915px) and (max-device-width: 1019px)" href="915.css">
<link rel="stylesheet" media="only screen and (min-width: 1020px), only screen and (min-device-width: 1020px)" href="1020.css">
<link rel="stylesheet" media="only screen and (min-width: 1200px) and (max-width: 1299px), only screen and (min-device-width: 1200px) and (max-device-width: 1299px)" href="1200.css">
<link rel="stylesheet" media="only screen and (min-width: 1300px), only screen and (min-device-width: 1300px)" href="1300.css">
【问题讨论】:
-
在 FF 中,两个版本在我看来完全一样。您在哪个浏览器和版本中遇到问题?
-
FF 12. 确保从最宽处缓慢拖动到最小处,以便它可以看到其他查询。我在我尝试过的每个浏览器中都看到了这个问题——FF、Chrome 等——我不确定你是否在较小的宽度上尝试它。
-
这里是 FF 12 和 Chrome 25 swanflighthaven.com/pagestuff/correct.jpg 和 swanflighthaven.com/pagestuff/incorrect.jpg 的屏幕截图
标签: css media-queries