<分区>
<分区>
所以,首先,我想说,我知道存在类似的问题,但这些都没有帮助我。
我只想创建一个框架,在一个标题中有 50 像素,另一个框架在这个“容器”中,高度为 100%。
但这行不通。
我已经尝试创建多个容器作为 div 等。 http://prntscr.com/ohshyn这是当前的结果。
...这是我当前使用的代码。
body {
background-color: black;
}
.container {
width: 500px;
height: 500px;
background-color: red;
padding: 10px;
}
.top {
width: 100%;
height: 50px;
background-color: green;
}
.bottom {
width: 100%;
height: 100%;
background-color: blue;
}
<div class="container">
<div class="top"></div>
<div class="bottom"></div>
</div>
我想看起来像这样:http://prntscr.com/ohsip9
最佳答案
你的 .bottom
类高度不应该是 100%,它应该是 100% - 50px(.top class height)
。用 calc
函数添加 .bottom
类高度,这样就可以了。
height: calc(100% - 50px);
关于html - div 高度为 100% 但带有标题行的 Div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57127915/