【问题标题】:Media Queries - Generic Responsive Templates媒体查询 - 通用响应模板
【发布时间】:2014-04-17 15:33:27
【问题描述】:


我想创建通用的响应式模板,
如果我想检测所有设备尺寸,我必须使用哪些媒体查询?

【问题讨论】:

    标签: html css media-queries


    【解决方案1】:
    【解决方案2】:

    我强烈推荐使用 Bootstrap。更快的发展。文档也非常完整。 http://getbootstrap.com/getting-started/

    至于你的问题,你有这个例子:

    /*Anything outside of media queries is for MOBILE
      This is Mobile first approach.
    */
    
    /* Small devices (tablets, 768px and up) */
    @media (min-width: 768px) { ... }
    
    /* Medium devices (desktops, 992px and up) */
    @media (min-width: 992px) { ... }
    
    /* Large devices (large desktops, 1200px and up) */
    @media (min-width: 1200px) { ... }
    

    【讨论】:

      【解决方案3】:

      查看Common CSS Media Queries Break Points

      /*------------------------------------------
        Responsive Grid Media Queries - 1280, 1024, 768, 480
         1280-1024   - desktop (default grid)
         1024-768    - tablet landscape
         768-480     - tablet 
         480-less    - phone landscape & smaller
      --------------------------------------------*/
      @media all and (min-width: 1024px) and (max-width: 1280px) { }
      
      @media all and (min-width: 768px) and (max-width: 1024px) { }
      
      @media all and (min-width: 480px) and (max-width: 768px) { }
      
      @media all and (max-width: 480px) { }
      
      
      /* Portrait */
      @media screen and (orientation:portrait) { /* Portrait styles here */ }
      /* Landscape */
      @media screen and (orientation:landscape) { /* Landscape styles here */ }
      
      
      /* CSS for iPhone, iPad, and Retina Displays */
      
      /* Non-Retina */
      @media screen and (-webkit-max-device-pixel-ratio: 1) {
      }
      
      /* Retina */
      @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
      only screen and (-o-min-device-pixel-ratio: 3/2),
      only screen and (min--moz-device-pixel-ratio: 1.5),
      only screen and (min-device-pixel-ratio: 1.5) {
      }
      
      /* iPhone Portrait */
      @media screen and (max-device-width: 480px) and (orientation:portrait) {
      } 
      
      /* iPhone Landscape */
      @media screen and (max-device-width: 480px) and (orientation:landscape) {
      }
      
      /* iPad Portrait */
      @media screen and (min-device-width: 481px) and (orientation:portrait) {
      }
      
      /* iPad Landscape */
      @media screen and (min-device-width: 481px) and (orientation:landscape) {
      }
      

      【讨论】:

      • 我正在使用上面的 css,但我网站上的按钮不符合样式。有什么建议吗?
      • 请提供 jsfiddle 以获得更好的想法。
      • 我昨天做了一些搜索,我发现 asp.net 按钮不服从它。有什么建议还是我应该继续使用 bootstrap 3?非常感谢
      猜你喜欢
      • 2017-03-13
      • 1970-01-01
      • 1970-01-01
      • 2018-08-11
      • 1970-01-01
      • 1970-01-01
      • 2019-05-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多