【问题标题】:iPad Pro 12.9 Media queries are not workingiPad Pro 12.9 媒体查询不起作用
【发布时间】:2017-10-06 17:01:12
【问题描述】:

我正在尝试为 iPad Pro 12.9 英寸版本实现以下媒体查询,但当我检查实际的 iPad 设备时它不起作用。

@media only screen   and (min-device-width: 1024px)   and (max-device-width: 1366px)   and (orientation: landscape)   and (-webkit-min-device-pixel-ratio: 2)
{
//CSS
}

上面的媒体查询在 Chrome 上工作,但是当我检查实际设备甚至 xCode 上的模拟器时,它不起作用。我也尝试过 (-webkit-min-device-pixel-ratio: 2)。相同的结果

【问题讨论】:

    标签: css media-queries


    【解决方案1】:

    这里是 iPad Pro 12.9 英寸的工作代码。 我因信息极度缺乏而苦苦挣扎,但我现在找到了工作参数。

    // For both Portrait and Landscape
    @media only screen
        and (min-device-width: 768px)
        and (max-device-width: 2732px)
        and (-webkit-min-device-pixel-ratio: 2){
           // CSS HERE
    }
    
    // For landscape
    @media only screen
        and (min-device-width: 768px)
        and (max-device-width: 2732px)
        and (orientation:landscape)
        and (-webkit-min-device-pixel-ratio: 2){
           // CSS HERE
    }
    
    // For Portrait
    @media only screen
        and (min-device-width: 768px)
        and (max-device-width: 2732px)
        and (orientation:portrait)
        and (-webkit-min-device-pixel-ratio: 2){
           // CSS HERE
    }
    

    【讨论】:

      猜你喜欢
      • 2019-06-15
      • 2018-05-12
      • 2017-10-31
      • 2016-05-20
      • 2018-07-04
      • 2013-12-10
      • 2023-03-30
      • 2020-03-20
      • 2014-02-21
      相关资源
      最近更新 更多