我有一些绝对定位的盒子。其中一个有嵌套的弹出窗口,比框大。我想在所有框前弹出。
设置z-index: 100
框和z-index: 200
弹出窗口无济于事。弹出框后按文档顺序排列的框似乎超出了弹出框。我想念 z 指数的什么?
div {
border: 1px solid black;
}
.container {
position: relative;
}
.foo {
position: absolute;
background-color: white;
width: 5em;
z-index: 100;
}
#b0 {
top: 0em;
left: 0em;
}
#b1 {
top: 3em;
left: 1em;
}
#b2 {
top: 6em;
left: 2em;
}
#b3 {
top: 9em;
left: 3em;
}
#b4 {
top: 12em;
left: 4em;
}
.popup {
z-index: 200;
position: absolute;
left: 1em;
top: -1em;
width: 8em;
height: 8em;
background-color: grey;
}
<div class="container">
<div class="foo" id="b0">
<span>absolute box b0</span>
</div>
<div class="foo" id="b1">
<span>absolute box b1</span>
<div class="popup">
popup box inside b1
</div>
</div>
<div class="foo" id="b2">
<span>absolute box b2</span>
</div>
<div class="foo" id="b3">
<span>absolute box b3</span>
</div>
</div>