我怎样才能在其他人的顶部显示显示div btn div ...在地图元素上定位绝对,并且必须保持原样。
其他如何在红色232323232
之上制作绿色1111111111jsfiddle here
<div class="map">
<div class="btn" style="top:20px; left:40px;">
1212121
<div class="reveal">1111111111</div>
</div>
<div></div>
<div class="btn" style="top:130px; left:100px;">
232323232
<div class="reveal">222222222</div>
</div>
</div>
.map{
background-color: yellow;
height: 600px;
width: 600px;
position: relative;
}
.btn{
background-color: red;
height: 100px;
width: 200px;
position:absolute;
z-index:3;
}
.reveal {
background-color: green;
height: 400px;
width: 200px;
display: none;
position:relative;
z-index:4;
}
答案 0 :(得分:3)
根据定义:
The z-index property specifies the stack order of an element.
An element with greater stack order is always in front of an element with a lower stack order.
要让1212121位于232323232之上,您必须在悬停更高的z-index时给予.btn