我想做一个收尾固定中间滚动的布局,但是首位固定之后,中间的盒子用相对定位却不显示,换成绝对定位之后才成功显示,这是为什么咧?html和css代码贴在下面啦:
<body>
<div class="header">
</div>
<div class="content">
</div>
<div class="footer">
</div>
</body>
.header {
position: fixed;
width: 100vw;
height: 6vh;
background-color: pink;
}
.footer {
position: fixed;
width: 100vw;
height: 6vh;
bottom: 0;
left: 0;
background-color: pink;
}
.content {
position: absolute;
top: 6vh;
bottom: 6vh;
left: 0;
right: 0;
background-color: blue;
}