<分区>
<分区>
我需要 div 底部来填充 PAGE 的剩余高度,而不是父 div
body, html {
margin: 0px;
}
.top {
background-color: green;
width: 100px;
height: 50px;
}
.bottom {
background-color: red;
width: 100px;
height: 100%;
}
<div class="top"></div>
<div class="bottom"></div>
最佳答案
您可以使用 calc
和 vh
来计算页面的 100% 高度减去 top
的 50px
分区。
看看这个片段:
body, html {
margin: 0px;
}
.top {
background-color: green;
width: 100px;
height: 50px;
}
.bottom {
background-color: red;
width: 100px;
height: calc(100vh - 50px);
}
<div class="top"></div>
<div class="bottom"></div>
关于html - CSS 填充页面的 Div 高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49510786/