gpt4 book ai didi

html - 如何将顶部div高度设置为剩余高度css

转载 作者:太空宇宙 更新时间:2023-11-04 13:02:46 24 4
gpt4 key购买 nike

我在屏幕底部有一个 positioned fixed 的 div,固定高度为 200 像素; 如何将其顶部的 div 高度设置为 剩余高度?

<div id="container"></div>
<div id="wrap"></div>

body {
padding: 0;
margin: 0;
color: #fff;
font: 18px "bonvenocf";
}

#wrap {
position: fixed;
bottom: 0;
text-align:center;
background: #1b1b1b;
width: 100%;
height:200px;
}

#container {
width: 100%;
background: #0084ff;
min-height:320px;
}

这是我的 fiddle :http://jsfiddle.net/8kLo0v9q/6/

最佳答案

更改您的容器 div 使其具有高度:100%:

#container {
width: 100%;
height: 100%;
background: #0084ff;
min-height:320px;
}

关于html - 如何将顶部div高度设置为剩余高度css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25343029/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com