IE6 and IE7 Z-INDEX bug

2019-06-06 06:19发布

问题:

After a few lost days, I have given up trying to solve this. So, here is the situation and I'll be really thankful if someone could tell me what I should do:

I have a vertical menu, and the second level of the menu is absolute positioned. The inner <ul> is styled position: absolute; and has a set z-index. The problem is ie6 and ie7-specific, which does not recognize the z-index in an absolute positioned block. If the element was a relatively positioned, there are no problems but I need the element to be positioned absolute.

Are there any suggestions? Thanks a lot to everyone who's going to give their advice or opinion.

回答1:

Try this if it helps.

Inside absolute div, add a relative div and put your code inside it.



回答2:

IE6 and IE7 have a z-index bug where each absolutely positioned element creates a new context for the stacking order. It's difficult to tell without seeing the html in question, but try adding position: relative; and z-index: 100 (or something above the z-index of your sub-menus) to the container (parent) of all the elements with position: absolute.