<分区>
<分区>
有没有人知道/解释为什么这段代码会影响垂直位置的 anchor ? 这种效果至少在 linux 上的 chrome v75 和 firefox v67 中会发生。
其实我希望:
.abs {
position: absolute;
width: 100%;
height: 100px;
background: red;
}
.static {
margin-top: 100px;
background: blue;
height: 200px;
width: 100%;
}
<header>
<div class="abs">Absolute or fixed should have no space to the top</div>
<div class="static"></div>
</header>
最佳答案
那样
.abs {
position: absolute;
width: 100%;
height: 100px;
background: red;
}
.static {
position:absolute;
top: 100px;
background: blue;
height: 200px;
width: 100%;
}
<header style="position:relative;">
<div class="abs">Absolute or fixed should have no space to the top</div>
<div class="static"></div>
</header>
关于html - child 的边缘影响祖先包括 body ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57274995/