【发布时间】:2019-04-06 08:40:40
【问题描述】:
这是一个代码笔,我的意思是: https://codepen.io/anon/pen/MReEQw,代码如下:
<div id="fixed">
</div>
<div id="content">
</div>
#fixed {
height: 50px;
width: 100%;
background-color: green;
position: fixed;
}
#content {
height: 2000px;
background: grey;
margin-top: 50px;
}
这是margin-collapse吗?为什么我不能设置一个固定的div,然后在它下面设置一个不重叠的div?
【问题讨论】:
-
你希望你的 div 固定在页面顶部还是你想要边距?