【问题标题】:css @media mobile/desktop: ensuring desktop doesn't show mobile csscss @media mobile/desktop:确保桌面不显示移动 css
【发布时间】:2012-12-30 23:39:18
【问题描述】:

一直在通过 CSS 对网站进行移动重新设计。

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

但是,当浏览器在 855 下调整大小时,桌面仍然会显示移动 css(虽然看起来只是一些移动 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" />

亲切的问候

【问题讨论】:

    标签: html css mobile media


    【解决方案1】:

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

    【讨论】:

    • 谢谢。必须使用 max-width 才能让 android mobile 正常工作。
    猜你喜欢
    • 2020-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-13
    • 2022-01-24
    • 2021-12-01
    • 1970-01-01
    相关资源
    最近更新 更多