【问题标题】:Media Query capturing everything with two styles媒体查询以两种样式捕获所有内容
【发布时间】:2015-09-16 01:27:36
【问题描述】:

我的显示器有两种基本样式。一种是左右两个盒子,一种是上下两个盒子。我的目标只是设置我的媒体查询,以便将所有情况分组到适当的设置(这两个选项中)。

出于某种原因,这个设置在我的nexus 6 上显示为“大”设置,尽管它应该显示在小设置上。怎么回事……

    <link rel="stylesheet" type="text/css" media="only screen and (min-device-width: 1px) and (max-device-width: 800px)" href="SmallStyle.css">
    <link rel="stylesheet" type="text/css" media="only screen and (min-device-width: 801px) and (min-width: 1px) and (max-width: 800px)" href="SmallStyle.css">
    <link rel="stylesheet" type="text/css" media="only screen and (min-device-width: 801px) and (min-width: 801px) and (max-width: 3000px)" href="BigStyle.css">

【问题讨论】:

    标签: android css html media-queries


    【解决方案1】:

    你为什么不使用 1 个带有媒体查询的 css 文件,如下所示:

    @media screen and (max-width: 800px) {
    //code here
    }
    

    【讨论】:

    • 只是因为我发现这样更容易保持直截了当。
    • 然后尝试删除设备宽度选项。像这样:
    猜你喜欢
    • 1970-01-01
    • 2021-05-30
    • 2014-10-19
    • 1970-01-01
    • 2012-10-12
    • 1970-01-01
    • 2014-04-09
    • 2020-01-20
    • 1970-01-01
    相关资源
    最近更新 更多