z-index在IE中的迷惑(二)
IE中z-index BUG
首先先来看一个演示例子的代码部分。
XHTML 部分:
<div id=”container”>
<div id=”box1″>这个box应该在上面</div>
</div>
<div id=”box2″>这个box应该在下面,IE浏览器会对定位元素产生一个新的stacking context ,甚至当元素 z-index的为“auto”。</div>
CSS 部分:
#container {
position: relative;
}
#box1 {
position: absolute;
top: 100px;
left: 210px;
width: 200px;
height: 200px;
background-color: yellow;
z-index: 20;
}
#box2 {
position: absolute;
top: 50px;
left: 160px;
width: 200px;
height: 200px;
background-color: green;
z-index: 10;
}
两个 box 被完全的定位,背景色为黄色的 box1 拥有 z-index 属性值 20,而背景色为绿色的 box2 拥... 0 条评论»
