【问题标题】:how to set the media features in media queries, like width is in between two pixels like 300px - 400px?如何在媒体查询中设置媒体功能,比如宽度在两个像素之间,比如 300px - 400px?
【发布时间】:2015-08-30 14:45:47
【问题描述】:

在媒体查询中

@media screen and (max-width: 300px) {
    body {
        background-color: lightblue;
    }
}

这将在屏幕的最小宽度为 300 像素时执行。 如果我想在宽度介于 300px - 500px 之间时执行代码,我将如何编写代码。

【问题讨论】:

    标签: css media-queries


    【解决方案1】:

    很简单

    @media screen and (max-width: 359px) and (min-width: 240px){
    
        .detail_image{height:160px; width:280px;}
        .video_cntrl{height:160px; width:auto;}
    }
    

    我强烈建议您使用基于纵横比的分辨率,它会解决您的顾虑。

    view它。

    【讨论】:

      【解决方案2】:
      @media screen and (min-width: 300px) and (max-width: 500px)
      {
          body {
                  background-color: lightblue;
               }
      }
      

      【讨论】:

        猜你喜欢
        • 2012-12-10
        • 2012-05-18
        • 2012-07-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-19
        • 1970-01-01
        相关资源
        最近更新 更多