【问题标题】:Media queries to target high resolution dense pixel devices针对高分辨率密集像素设备的媒体查询
【发布时间】:2012-07-25 09:08:56
【问题描述】:

我们正在尝试专门针对三星 Galaxy Nexus。它的分辨率为 1280 x 720,像素密度为 2,这使得它可以像桌面设备一样显示页面。

我们试过了

@media screen and (max-device-width : 720px) and (-webkit-max-device-pixel-ratio : 2) and (portrait) {};

和

@media screen and (max-device-width : 720px) and (-webkit-max-device-pixel-ratio : 2) {};

以及各种其他组合。在不影响桌面、平板电脑或其他手机布局的情况下,我们似乎无法专门针对此设备。

任何帮助将不胜感激。

【问题讨论】:

    标签: android css media-queries


    【解决方案1】:

    您的媒体查询不正确:

    @media only screen
    and (min-device-width : 720px)
    and (-webkit-min-device-pixel-ratio : 2)
    and (orientation : portrait) { /* styles */ };
    
    @media only screen
    and (min-device-width : 720px)
    and (-webkit-min-device-pixel-ratio : 2) { /* styles */ };
    

    不确定第二个的目标是什么。您可能需要考虑添加以下媒体查询:

    @media only screen
    and (min-device-width : 1280px)
    and (-webkit-min-device-pixel-ratio : 2)
    and (orientation : landscape) { /* styles */ };
    

    试试看。

    【讨论】:

    • 我只是错过了屏幕前的“唯一”吗?
    • 那个和orientation :在portrait之前。
    • @media only screen and (max-device-width : 720px) and (-webkit-max-device-pixel-ratio : 2) and (orientation : portrait) {} 也适用于其他手机(iPhone、HTC 不可思议等)
    • 呃...改成min-device-width.
    • 这也将针对 iPad 3。不是你要找的,我想。好吧,实际上,不是在横向模式下。 iPad 3 的纵向是 768 像素。可能需要做更多的挖掘工作。
    猜你喜欢
    • 2017-03-13
    • 1970-01-01
    • 1970-01-01
    • 2014-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-12
    相关资源
    最近更新 更多