【问题标题】:What will be the media queries for specific devices?特定设备的媒体查询是什么?
【发布时间】:2014-02-27 21:05:16
【问题描述】:

我正在研究响应式设计,但没有正确完成。我需要为这些设备的分辨率编写媒体查询。

240*320,

240*480,

320*480,

480*800,

480*856

到目前为止,我已经尝试过这些媒体查询,但它们相互冲突

 @media only screen and (max-width:240px) { /* cover 240px portrait */}

 @media only screen and (min-width:320px) and (orientation : landscape) {/* cover 320px landscape for 240*320 */}

 @media only screen and (min-width : 479px) and (orientation : landscape) {/* cover 480px landscape */}

 @media only screen and (min-width : 480px) and (orientation:portrait) {/* cover 480px portrait */}

【问题讨论】:

    标签: html css responsive-design media-queries


    【解决方案1】:

    以下是标准设备的媒体查询。您可以单独编写全局样式,也可以在定义的媒体中编写特定于设备的样式。

    /* Smartphones (portrait and landscape) ----------- */
    @media only screen 
    and (min-device-width : 320px) 
    and (max-device-width : 480px) {
    /* Styles */
    }
    
    /* Smartphones (landscape) ----------- */
    @media only screen 
    and (min-width : 321px) {
    /* Styles */
    }
    
    /* Smartphones (portrait) ----------- */
    @media only screen 
    and (max-width : 320px) {
    /* Styles */
    }
    
    /* iPads (portrait and landscape) ----------- */
    @media only screen 
    and (min-device-width : 768px) 
    and (max-device-width : 1024px) {
    /* Styles */
    }
    
    /* iPads (landscape) ----------- */
    @media only screen 
    and (min-device-width : 768px) 
    and (max-device-width : 1024px) 
    and (orientation : landscape) {
    /* Styles */
    }
    
    /* iPads (portrait) ----------- */
    @media only screen 
    and (min-device-width : 768px) 
    and (max-device-width : 1024px) 
    and (orientation : portrait) {
    /* Styles */
    }
    
    /* Desktops and laptops ----------- */
    @media only screen 
    and (min-width : 1224px) {
    /* Styles */
    }
    
    /* Large screens ----------- */
    @media only screen 
    and (min-width : 1824px) {
    /* Styles */
    }
    
    /* iPhone 4 ----------- */
    @media
    only screen and (-webkit-min-device-pixel-ratio : 1.5),
    only screen and (min-device-pixel-ratio : 1.5) {
    /* Styles */
    }
    

    更多信息here。希望有帮助。

    【讨论】:

    • 需要更多关于如何编写这些的详细信息?
    【解决方案2】:

    我在media queries for various ios devices 上写了这篇小文章。所有这些答案都会让你更接近。由您决定适合您项目的正确组合。

    【讨论】:

      猜你喜欢
      • 2013-01-01
      • 1970-01-01
      • 2017-05-14
      • 2013-03-12
      • 1970-01-01
      • 2021-08-25
      • 2017-11-21
      • 1970-01-01
      • 2014-12-18
      相关资源
      最近更新 更多