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

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

CSS代码

  body { margin: 0; padding: 0; text-aligncenterbackground-color#eee; }   

  #bd { margin20px autopadding5px 20px 20pxborder1px solid #bbbwidth760pxbackground-color:#9CCE2E;  }             #popup {width300px;height100px;padding10px;positionabsolute;left443px;top57px;border1px solid blue;background-color#fff;filter:alpha(opacity=60);opacity:0.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代码

  

<div id="bd">
  <h1>IE6下div遮盖select的解决方案</h1>
    <div class="parameter">

      <label for="ddTest">Test</label>
      <select id="ddTest">
        <option>…</option>
        <option>pick me</option>
      </select>
    </div>
  </div>
  <div id="popup">
    Is the select element poking through?
    <!–[if lte IE 6.5]><iframe></iframe><![endif]–>
  </div>

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


转载请注明转自《【IE6的疯狂之五】div遮盖select的解决方案

posted @ 2013-09-24 16:28  小周同学  阅读(270)  评论(0编辑  收藏  举报