【问题标题】:Media Query for iPad (Landscape) applied to Samsung Galaxy Tab 2 (Landscape) as well适用于 iPad(横向)的媒体查询也适用于三星 Galaxy Tab 2(横向)
【发布时间】:2012-12-22 00:10:05
【问题描述】:

我正在 iPad(1,2) 以及 Samsung Tab 2 上测试我的网络应用程序。我有不同的 CSS(external) 集应用于 iPad 上的横向/纵向模式和选项卡 2 上的横向/纵向模式。

但我无法为 Tab 2 编写正确的媒体查询。与我的喜好相反,要应用于 iPad Landscape 的 CSS 也适用于 Tab 2 的横向模式!

这是我尝试过的:

<link rel="Stylesheet" type="text/css" media="only screen and (min-device-width : 600px) and (max-device-width : 1024px) and (orientation : landscape)"
    href="CSS/TabLandscape.css" />
<link rel="Stylesheet" type="text/css" media="only screen and (min-device-width : 600px) and (max-device-width : 1024px) and (orientation : portrait)"
    href="CSS/TabPortrait.css" />
<link rel="Stylesheet" type="text/css" media="only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape)"
    href="CSS/iPadLandscape.css" />
<link rel="Stylesheet" type="text/css" media="only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait)"
    href="CSS/iPadPortrait.css" />

注意: i. 根据规格,三星 Tab 2 的分辨率为 1024x800。

二。 我不能将min-device-pixel-ratio : 1 用于 Tab 2,因为 iPad(1) 也具有相同的值。

【问题讨论】:

    标签: css media-queries


    【解决方案1】:

    最后我是这样实现的:

    <link rel="Stylesheet" type="text/css" media="only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape)"
        href="CSS/iPadLandscape.css" />
    <link rel="Stylesheet" type="text/css" media="only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait)"
        href="CSS/iPadPortrait.css" />
    <link rel="Stylesheet" type="text/css" media="only screen and (device-width : 1024px) and (orientation : landscape)"
        href="CSS/TabLandscape.css" />
    <link rel="Stylesheet" type="text/css" media="only screen and (device-width : 600px) and (orientation : portrait)"
        href="CSS/TabPortrait.css" />
    

    事实证明,拥有 1024x800 分辨率的三星 Tab 2(P3100) 在纵向模式下可以匹配到 device-width: 600pxAndroid Stock Browser

    【讨论】:

    • 谢谢你。我一直在努力寻找正确的查询。
    猜你喜欢
    • 2019-01-21
    • 1970-01-01
    • 2023-03-20
    • 2020-01-20
    • 2013-01-27
    • 1970-01-01
    • 2011-11-09
    • 2017-08-28
    • 2015-05-25
    相关资源
    最近更新 更多