这是html:
<div id = "parent">
<div id = "one" ></div>
<div id = "two" ></div>
</div>
的CSS:
#parent
{
position: relative;
}
#parent > #one
{
position: absolute;
z-index: 10;
top: 50px;
left: 50px;
width: 100px;
height: 100px;
background: white;
}
#parent > #two
{
position: absolute;
z-index: 5;
top: 50px;
left: 50px;
height: 50px;
width: 50px;
background: black;
}
ie7 +和opera中的问题是div“one”不重叠div“two”,为什么会这样?
答案 0 :(得分:0)
尝试使用以下内容:
<div id = "parent">
<div class= "one" ></div>
<div class= "two" ></div>
</div>
css:
#parent
{
position: relative;
width: 150px;
height: 150px;
background: yellow;
}
#parent .one
{
position: absolute;
z-index: 10;
top: 50px;
left: 50px;
width: 100px;
height: 100px;
background: white;
}
#parent .two
{
position: absolute;
z-index: 5;
top: 50px;
left: 50px;
height: 50px;
width: 50px;
background: black;
}
希望你能得到线索