我有以下HTML代码 - 无论我怎么做,似乎都不能让中间的
显示在顶部以及底部之上。它可以正常显示在顶部上方,但是当我期望底部出现在中间下方时,底部实际上却显示在中间上方。有什么想法吗?下面是Jsfiddle链接..非常感谢!
<body>
<div>
<div id="tdiv" >Top Div</div>
<div id="connector">Middle Didv</div>
<div id="bdiv">Bottom Div </div>
</div>
</body>
#tdiv{
height:200px; border:10px dotted black ;
margin-bottom: -100px;
background:red;
}
#connector{
height:200px;border:10px solid black;
background:blue;
margin-bottom: -100px;
z-index: 21;
}
#bdiv{
border:21px dashed black;
height:200px;
z-index: 1;
background:green;
}
position
属性时,z-index
才能生效。 - Brad