gpt4 book ai didi

css - 使 2 div 填充页面响应具有固定页脚和页眉的浏览器

转载 作者:行者123 更新时间:2023-11-28 10:37:01 25 4
gpt4 key购买 nike

我有一个 50px 的固定页眉和页脚,我想要一个上下 div 来填充页面的其余部分而不重叠。这是我的

section{
width:100%;
text-align: center;
}

section .lower, section .upper{
width: 100%;
height: 40%;
position:absolute;
padding: 5px 0;
z-index: 901;
text-align: center;
display:block;
clear: both;
}

section .upper{
top: 50px;
left: 0;
background-color: white;
opacity:.2;
}

section .lower{
bottom: 50px;
left: 0;

background-color: #afa;
opacity: 0.2;
}

最佳答案

有这两种可能性:

  1. 使用display:flex; DEMO
  2. 使用框模型与 box-sizing:border-box,padding, absolute, relative高度。 <强> DEMOheaderfooter 必须具有已知的高度。 (px,em,vh,..)

关于css - 使 2 div 填充页面响应具有固定页脚和页眉的浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23298873/

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