正如您在 此链接 中所看到的,在页面底部有一个包含谷歌地图的 div。我想在谷歌地图区域内放置一个红色 DIV (.blocktest)。问题是,尽管红色 DIV 具有比地图更高的 z-index(它可能在地图后面),但它并不可见。问题出在哪里?谢谢
样式:
HTML:
<div id="fullcontainer"></div>
<div id="map"><div id="map-canvas"><div class="blocktest">div that should be above the map</div></div></div>
样式:
#fullcontainer {
margin-bottom:300px;
position:relative;
z-index:2000;
background: #F2F2F2;
}
.blocktest {
width: 60%;
background: red;
z-index: 30;
position: absolute;
left: 20px;
bottom: 56px;
}
#map {
position:fixed;
z-index:1;
height:400px;
bottom:0;
width:100%;
}
#map, #map-canvas {
width: 100%;
height: 400px;
float: left
}
#fullcontainer
中使用z-index
,这会对你产生很大的影响。 - Praveen