如果我有
<div class="above-header">SOME STUFF</div>
<header>
<div class="inside-header">SOME MORE STUFF</div>
</header>
和inside-header
是position: absolute
with z-index: 1
, and above-header
position: relative
与z-index: 10
,为什么inside-header
出现在above-header
之上?
最佳答案
因为 .inside-header 是 header 的子元素,并且在 header 中是绝对定位的。所以你需要使 header position: absolute 与 z-index: 1
关于html - Z-Index 与 sibling 的 child ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20846806/