【问题标题】:Bootstrap multiple resolution all layout inline media query CSS for responsive design including Android iphone and web asp.netBootstrap 多分辨率所有布局内联媒体查询 CSS 用于响应式设计,包括 Android iphone 和 web asp.net
【发布时间】:2013-08-27 07:08:44
【问题描述】:

我已经完成了一个网站,它现在在浏览器中运行良好。我被要求使其与 Android、iPhone、iPad、平板电脑和网络等兼容。我正在使用 bootstrap asp.net。

现在我正在尝试但找不到任何答案。我正在使用这些内联媒体查询

@media screen and (min-width:0px) and (max-width:320px){/*Any css will be defined here*/}
@media screen and (min-width:321px) and (max-width:480px){/*Any css will be defined here*/}
@media screen and (min-width:481px) and (max-width:540px){/*Any css will be defined here*/}
@media screen and (min-width:541px) and (max-width:775px){/*Any css will be defined here*/}
@media screen and  (min-width:768px) and (max-width:783px){/*Any css will be defined here*/}
@media screen and (min-width:776px) and (max-width:1536px){/*Any css will be defined here*/}
@media screen and (min-width:1537px){/*Any css will be defined here*/}

但在某些 iPad 中未应用 CSS。现在我的问题是,@media 的标准分辨率和方向将涵盖所有(Android、iPhone、平板电脑和 Web 等)CSS?

【问题讨论】:

    标签: asp.net css twitter-bootstrap media-queries screen-resolution


    【解决方案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),
    and (min-device-pixel-ratio : 1.5) {
    /* Styles */
    }
    

    这就是我使用的,它几乎适用于所有东西。

    【讨论】:

    • 在@media 776 和 1223 之间的宽度不起作用,否则您的答案是可以接受的
    【解决方案2】:

    花了很多时间后,我发现这很有帮助。这是 Bootstrap 本身使用的,我遵循了它。它将涵盖所有设备(Android、iPhone 标签和网络等)。

        @media handheld, only screen and (max-width: 2200px)
        {
         /* Styles */
        }
        @media handheld, only screen and (max-width: 1200px) 
        {
         /* Styles */
        }
        @media handheld, only screen and (max-width: 1024px) 
        {
        /* Styles */    
        }
        @media handheld, only screen and (max-width: 767px) {
         /* Styles */
        }
        @media handheld, only screen and (max-width: 600px) {
         /* Styles */
        }
        @media handheld, only screen and (max-width: 500px) {
         /* Styles */
        }
        @media screen and (-webkit-min-device-pixel-ratio:0) {
        /* Styles */
        }
    

    【讨论】:

      猜你喜欢
      • 2013-01-22
      • 1970-01-01
      • 2011-12-26
      • 1970-01-01
      • 1970-01-01
      • 2013-04-20
      • 2012-07-06
      • 1970-01-01
      • 2018-09-13
      相关资源
      最近更新 更多