IE7, dropdowns, and z-index

I spent most of yesterday and most of this morning battling with a IE7 display bug.

Back story: we are using jQuery’s superfish drop down menus (a jQuery based implement of suckerfish/son of suckerfish) for site navigation. Everything works great in Firefox 2/3 and Safari. I’m going to assume that IE6 looks great as well since suckerfish is known to work well in IE6.

IE7 is a different story.

There is a large image directly beneath the navigation menu. Unfortunately for me, in IE7 the menu was being rendered beneath the image, despite having a z-index of 1001.

After some careful (and careless) digging and googling, I came across a solution.

To summarize, IE7 will not render the menu with the appropriate z-index unless that z-index is present on the top level :hover style. To clarify:


/*** ESSENTIAL STYLES ***/
.sf-menu, .sf-menu * {
margin: 0;
padding: 0;
list-style: none;
}
.sf-menu {
line-height: 1.0;
}
.sf-menu ul {
position: absolute;
top: -999em;
}
.sf-menu li:hover {
z-index: 100; /* This is the important style directive, without it IE7 chokes */
}
.sf-menu * li:hover {
visibility: inherit; /* fixes IE7 'sticky bug' */
font-weight: bold;
}

IE7 Suckerfish Hover CSS

Comments

7 Comments so far. Leave a comment below.
  1. Fatereh,

    hi,
    I need the free book of jqurey.

  2. You can find jquery documentation at http://docs.jquery.com
    Apart from that, I don’t know of any free jquery books.

  3. Jeff Wiegand,

    Dude, Thanks!!!!! I was going crazy trying to figure this out. Worked like a charm.

  4. Matt,

    From one dev to another, thank you so much. Stopped me from pulling out my hair

  5. Thank you, thank you, thank you. You just saved me a lot of swearing!

  6. Simon,

    Thankyoum this was starting to really get to me…

Add Your Comments

Disclaimer
Your email is never published nor shared.
Required
Required
Tips

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <ol> <ul> <li> <strong> <p>

Ready?

This site is protected with Urban Giraffe's plugin 'HTML Purified' and Edward Z. Yang's Powered by HTML Purifier. 226 items have been purified.