父绝对必须在子绝对之下 如何用css解决这个问题?
位置必须是绝对的。
<div class="parent">
<div class="child">child</div>
</div>
<div class="parent">
<div class="child">child</div>
</div>
最佳答案
编辑这个类:
.child {
position: absolute;
right: -280px; /* add this and remove left:0; */
top: 0;
text-align: center;
width: 280px;
height: 300px;
background: #0f0;
display: none;
z-index: 1; /* add this to set child over the second parent */
关于javascript - 父级绝对 z-index 中的子级绝对位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19334411/