我在容器 div 中有两个 DIV,我需要将它们都设置为适合浏览器窗口,如下所示,但它不适合我的代码,请给我一个解决方案建议
我的样式表代码
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.container {
height: auto;
width: 100%;
}
.div1 {
float: left;
height: 100%;
width: 25%;
}
.div2 {
float: left;
height: 100%;
width: 75%;
}
正文
<body>
<div class="container">
<div class="div1"></div>
<div class="div2"></div>
</div>
最佳答案
你也可以使用 viewport percentages如果您不关心老式 IE。
高度:100vh;
关于html - 使用 CSS 设置 div 高度以适应浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18934141/