【IE6的疯狂之五】div遮盖select的解决方案

IE6以及一下版本下,选择框Select会覆盖Div中的内容
一般情况下,可以将显示的内容放到Iframe中,然后再显示框架内的内容。由于Iframe的可以显示在Select上层,就可以解决这个问题。不过这样做在实现上比较麻烦。有个解决的部分就是在Div内容中加入不显示的Iframe框架即可,不用修改其他内容。
例如:http://www.css88.com/demo/div_select/div_select.html

CSS代码
  1. body { margin: 0; padding: 0; text-aligncenterbackground-color#eee; }   
  2. #bd { margin20px autopadding5px 20px 20pxborder1px solid #bbbwidth760pxbackground-color:#9CCE2E;  }   
  3. #popup {width300px;height100px;padding10px;positionabsolute;left443px;top57px;border1px solid blue;background-color#fff;filter:alpha(opacity=60);opacity:0.4;}   
  4. #popup iframe{display:none;/*sorry for IE5*/display/**/:block;/*sorry for IE5*/position:absolute;/*must have*/top:0;/*must have*/left:0;/*must have*/z-index:-1;/*must have*/filter:mask();/*must have*/width: 100%;/*must have for any big value*/height: 100%;/*must have for any big value*/;}  

 

尤其注意这个样式:

#popup iframe{display:none;/*sorry for IE5*/display/**/:block;/*sorry for IE5*/position:absolute;/*must have*/top:0;/*must have*/left:0;/*must have*/z-index:-1;/*must have*/filter:mask();/*must have*/width: 100%;/*must have for any big value*/height: 100%;/*must have for any big value*/;}  

 

XML/HTML代码
  1. <div id=“bd”>  
  2. <h1>IE6下div遮盖select的解决方案</h1>  
  3. <div class=“parameter”>  
  4. <label for=“ddTest”>Test</label>  
  5. <select id=“ddTest”>  
  6. <option></option>  
  7. <option>pick me</option>  
  8. </select>  
  9. </div>  
  10. </div>  
  11. <div id=“popup”>  
  12. Is the select element poking through?   
  13. <!–[if lte IE 6.5]><iframe></iframe><![endif]–>  
  14. </div>  

转载注明:http://www.css88.com/article.asp?id=503
注意:<!–[if lte IE 6.5]><iframe></iframe><![endif]–>:表示在IE6下显示<iframe></iframe>,但是我们从样式中可以看出这个iframe是看不到的;
目前存在的bug:IE6下下拉框(select)看不到。

posted @ 2011-04-28 15:33  likozhang  阅读(561)  评论(0编辑  收藏  举报