zIndex属性在IE中无效

在ie中他的子类的zindex就以父类为准;

 <!doctype html>
 <html>
 <head>
 <meta charset="utf-8">
 <title>无标题文档</title>
 <style>
 #div1{ width:200px; height:200px;  float:left; border:1px solid red;}
 #div2{ width:200px; height:200px;  float:left; border:1px solid black;}

 .blue{ width:300px; height:300px; background-color:blue;}
 .green{ width:300px; height:300px; background-color:green;}
 </style>
 </head>

 <body>
 <div id="div1" style="position:relative;z-index:1;">
     <div class="blue" style="position:absolute;z-index:9999"><span style="color:red;">zIndex:9999</span></div>
 </div>

 <div id="div2" style="position:relative;z-index:2;">
     <div class="green" style="position:absolute;z-index:10"><span style="color:#fff">zIndex:10</span></div>
 </div>
 </body>
 </html>

div1子类的zindex为9999,父类的zindex为1, div2的子类的zindex为10,父类的zindex为2,比较父类的zindex大小,所以div1,无法覆盖div2

上一篇:手工、工具分别实现cookie注入


下一篇:oo第一次作业