CSS Dropdown menu hidden behind content IE7

2019-02-24 20:47发布

问题:

I have a dropdown css menu that gets gets hidden behind the main page content when viewed in IE7. I've tried changing z-index values but have had no luck. I've also tried suggestions in other topics from this site but none have worked.

the page can be found here: www.melbournedodgeball.com.au/dodgeball2012/about

any help would be greatly appreciated

回答1:

The CSS spec's paragraph on Z-index says that new stacking context is only created for positioned content with a z-index other than auto.

You have the li inside #nav with a position:relative, an apparently IE interprets this as a new stacking context.

Try this:

#nav li {
    display: block;
    position: relative;
    z-index: 1;         // force IE to recognize stack at this point
}


回答2:

You need to add

position:relative;

To your <ul>

Z-Index is specified relative to all other elements in the same stacking context. You can have a Z-Index of 100 but it wont make a bit of difference if the elements belong to completely different stacking contexts.



回答3:

I have test this code, It will work sure Please set this css for IE7 only

#menu {position:relative; z-index:100;}