Tuesday, April 20, 2010

IE6中select组件与css中z-index的冲突

Positioned Elements and OS Controls, Applets and Plug-ins这篇文章中,描述了当position为absolute一个DIV被拖到select组件上方的时候,在IE6中,select组件会透过DIV层显示出来,这并不是想要的效果,这个问题并非是一个bug,因为在IE6中,select元素是一个window控制组件,并不支持z-index属性,在IE7之后则开始支持z-index属性,更详细的说明可查看MSDN关于select的文档:
From Microsoft Internet Explorer 5 to Internet Explorer 6, This element is a windowed control and does not support the z-index attribute or zIndex property.
As of Internet Explorer 7, this element is windowless and supports the z-index attribute and the zIndex property. The SELECT element does not require a strict doctype to enable windowless functionality.
This element is an inline element.
This element requires a closing tag.