【问题标题】:Responsive website showing large screen view on high pixel density mobile devices在高像素密度移动设备上显示大屏幕视图的响应式网站
【发布时间】:2014-03-10 09:08:12
【问题描述】:

使用媒体查询我为不同的像素数屏幕创建了不同的视图。但现在在像素数较高的小屏幕(如 iPhone5、S3、S4)上会显示桌面视图。

如何显示小屏幕视图 i. e. 520px 在这些高清屏幕手机上查看?

欢迎使用一些元标记或任何可以提供帮助的 html。

【问题讨论】:

  • 请把not working 代码贴在这里或在小提琴中。

标签: html responsive-design media-queries web-deployment mobile-website


【解决方案1】:

尝试将这两行添加到 HTML 文件的顶部。

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

【讨论】:

    【解决方案2】:
    <header>
     <meta name="viewport" content="width=device-width">
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    </header>
    

    css

    /* Smartphones (portrait and landscape) ----------- */
    @media only screen
    and (min-width : 320px)
    and (max-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-width : 768px)
    and (max-width : 1024px) {
    /* Styles */
    }
    
    /* iPads (landscape) ----------- */
    @media only screen
    and (min-width : 768px)
    and (max-width : 1024px)
    and (orientation : landscape) {
    /* Styles */
    }
    
    /* iPads (portrait) ----------- */
    @media only screen
    and (min-width : 768px)
    and (max-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 */
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-06
      • 2018-06-25
      • 2018-06-16
      • 1970-01-01
      • 2017-05-31
      • 2011-09-20
      相关资源
      最近更新 更多