Z-index in Internet Explorer not working

霸气de小男生 提交于 2019-12-28 05:45:23

问题


I've created a menu for a mobile site, when you click the menu button the menu slides opend, this is the page;

http://www.roadtotheweb.com/m.about.html

The only problem is that in IE and Windows phone the menu is not the top-most element so slides behind objects.

I have tried to change the z-index, position type, hasLayout to no avail.

I would appreciate any assistance.

J


回答1:


It looks like you might be dealing with a known bug:

“In Internet Explorer positioned elements generate a new stacking context, starting with a z-index value of 0. Therefore z-index doesn’t work correctly.”

You can see the bug report on Quirksmode website and a workaround explained in this blog post.

Essentially what you have to do is wrap it in an element with higher Z-index, for example Here is a quick sketch of a workaround:

<div style="position: relative; z-index: 3000">
    <div style="position:absolute;z-index:1000;">
        ...
    </div>
</div>



回答2:


I regularly swap two layers, changing the z-Index from 0 to 1, and visa-versa. After years, it stopped working in IE. I changed the z-Index to 1 and 2. It now works fine. I think the bug has to do with a 0 z-Index.




回答3:


If still not working, make sure Compatibility Mode is turned off for the site.



来源:https://stackoverflow.com/questions/12517158/z-index-in-internet-explorer-not-working

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