首页 > 解决方案 > 我无法对高度一 div 进行媒体查询

问题描述

我的项目中有几个 div,当我将具有新 div 高度的媒体查询添加到 css 样式表时,当我在 firefox 响应模式下打开它时,它将不起作用。我已经很沮丧了,因为不同的查询有效,但高度不合作。

html:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

CSS:

.div2-area{
 background-color: grey;
 width: 100%;
 height: 200vh;
 font-family: 'Palatino Linotype';
 text-align: left;
 color: white;
 background-position: center center;
 background-size: cover;
 background-repeat: no-repeat;
 background-image: url(../images/33.jpg);
}
@media only screen and (max-width: 300px) {
  .div2-area {
    height: 450vh;
  }
}

标签: htmlcss

解决方案


推荐阅读