Internet Explorer CSS property “filter” ignores overflow:visible

时光毁灭记忆、已成空白 提交于 2019-12-03 10:58:32

It seems that the workaround to this is simple: Use -ms-filter rather than filter:

-ms-filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=50)';

First, one interesting note: IE9 seems to correctly honor overflow:visible, even when emulating IE8.

Second, one general workaround to this issue would be to make your #container and #child siblings of one another inside of a common parent. The common parent would have no filter (meaning overflow will function correctly), and you would apply the filter you need to #container.

Because #child is no longer really a child of container, however, it will not receive your filter. This may or may not be a problem, and one possible solution is to apply the same filter to #child as well. I say this is a "possible solution" because applying the filter to the two elements independently, then composing them may or may not be identical to composing the elements first, then applying the filter to that composition. It depends what the filter is, and on whether or not the elements overlap. Even if it is not identical, it might be "close enough."

Finally, if your page has a doctype that puts it into standards mode (instead of the quirks mode to which IE defaults when there is no doctype), you may notice that filters do not apply to child elements unless the child has position:static (the default when no position is specified). Specifying either position:absolute or position:relative on the child will cause the filter on the parent not to apply to the child. Generally, this is a bad thing, but a side effect is that it will cause overflow:visible to work correctly.

If you adopt this solution, you will have the same problem that you may need to apply the filter to the child element as well.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!