如何解决在7+和Opera中出现z-index问题
| 这是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 \”没有重叠,这是为什么?
解决方法
尝试在下面使用:
<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;
}
希望你能找到线索
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。