适用于宽度和高度的媒体查询

时间:2019-12-19 04:02:52

标签: html css media

我有一个媒体查询来检查屏幕高度,如下所示,但无论屏幕高度(1200还是1050)如何,只有第一个查询适用,并将高度设置为94%。 谁能帮我解决这个问题。

谢谢

@media screen and (min-device-width: 1920px) and (max-device-height: 1200px) {
     .tab-content-parent-ht {
        height:94%;            
      }
 }

@media screen and (min-device-width:1920px) and (max-device-height: 1050px) {
    .tab-content-parent-ht {
         height:91.5%;            
     }
 }

1 个答案:

答案 0 :(得分:0)

您可以如下修改代码:

@media screen and (min-device-width: 1920px) and (min-device-height: 1051px) {
     .tab-content-parent-ht {
        height:94%;            
      }
 }

@media screen and (min-device-width:1920px) and (max-device-height: 1050px) {
    .tab-content-parent-ht {
         height:91.5%;            
     }
 }
相关问题