z-index
我有一个关于internet explore 8
. 我有一个主容器,里面有几个divs
。我的问题是我用来在主容器内的孩子之上javascript
创建新的。由于某些原因,即使主容器 div是 1,主边框也只是新创建的顶部。更清楚地说,这就是它的样子:divs
divs
div
div
z-index
IE8
----
| | <--newly created div generated by js
-----------------
| | | |
| ---- |
| |
| |
-----------------
想要的输出..
----
| | <--newly created div generated by js
--------| |---
| | | |
| ---- |
| |
| |
-----------------
我的html
<div id='container'>
<div>
<a href='#'/> //hover to a will generate a new div. //before hover
<a href='#'> // <- after hover to the link
<div id='newDiv'>
contents....
</div>
</a>
</div>
</div>
css
#container{
background-color: #FFFFFF;
border: 1px solid #364B78;
position: relative;
padding: 10px;
clear: both;
min-height: 200px;
z-index: 1;
}
#newDiv{
position: absolute;
background-color: red;
top: -175px;
left: 50px;
width: 200px;
height: 150px;
z-index: 1000;
padding: 8px;
}
此问题仅发生在 IE8 和 IE7 中。有没有办法解决这个问题?非常感谢!
编辑:
我刚刚发现问题实际上来自我容器中的 div 的背景图像div
<div id='container'>
<div>
<a href='#'/> //hover to a will generate a new div. //before hover
<a href='#'> // <- after hover to the link
<div id='newDiv'>
contents....
</div>
</a>
<div id='border'></div> //this is the problematic div
</div>
</div>
css
#border {
position:absolute;
top:0px;
left:0px;
height:4px;
width:100%;
background-image:url(/images/top.gif);
//the top.gif is a 2px height and 100% width image which on top of the new div
z-index: 1;
}