【发布时间】:2018-11-18 05:23:21
【问题描述】:
我有一个简单的绝对 div,后面还有另一个普通 div。为什么绝对 div 呈现在另一个之上?
我知道我可以用 z-index 修复它 - 但原因是什么?
JSBIN: http://jsbin.com/yadoxiwuho/1
<style>
.with-absolute {
position:absolute;
top:0px;
bottom:0px;
background-color:red
}
.other {
background-color:yellow;
}
</style>
</head>
<body>
<div class="with-absolute">Hello</div>
<div class="other">Why is this not on top? It comes last</div>
</body>
【问题讨论】:
标签: html css css-position