css @media mobile / desktop:确保桌面不显示移动css

时间:2012-12-30 23:39:18

标签: html css mobile media

只是通过CSS进行网站的移动重新设计。

让以下媒体查询为桌面或移动设备提供适当的css

但是,当浏览器在855下调整大小时,桌面仍会显示移动css(虽然它似乎只是部分移动css文件)

如何确保桌面永远不会加载移动设备?

感谢

<link rel="stylesheet" type="text/css" href="css/layout.css" media="Screen and (min-device-width:855px),projection" />
<link rel="stylesheet" type="text/css" href="css/nav.css" media="Screen and (min-device-width:855px),projection" />
<link rel="stylesheet" type="text/css" href="css/type.css" media="Screen and (min-device-width:855px),projection" />

<link href="css/mobile.css" type="text/css" media="handheld, handheld and (max-device-width: 854px), only screen and (max-device-width: 854px), only screen and (max-width:854px)" rel="stylesheet" />
<link href="css/mobile-nav.css" type="text/css" media="handheld, handheld and (max-device-width: 854px), only screen and (max-device-width: 854px), only screen and (max-width:854px)" rel="stylesheet" />
<link href="css/mobile-type.css" type="text/css" media="handheld, handheld and (max-device-width: 854px), only screen and (max-device-width: 854px), only screen and (max-width:854px)" rel="stylesheet" />

亲切的问候

1 个答案:

答案 0 :(得分:1)

在移动样式表媒体查询结束时,您有以下规则:only screen and (max-width:854px)。当浏览器在855px下调整大小时,这将应用样式表。如果您只希望样式表应用于宽度为854px或更小的设备,请仅使用max-device-width属性。