Position relative + z-index = IE Bug

The problem

If you’re dealing with absolutely or relatively positioned elements and you’re noticing that the z-index property doesn’t seem to work, you may be encountering yet another IE bug.  In certain cases, IE 6 especially will ignore the z-index property of elements whose parents don’t have a z-index.

The Solution

The credit goes to Nathan Ostgard for his Position Relative, z-index IE Bug fix.  Just give your container, or parent element a z-index of any number.  We added:

z-index:1

15 Responses to “Position relative + z-index = IE Bug”

  • Bart Lagerweij Says:

    Thanks, solved my IE6 problem!

  • @ Zele Says:

    Thank you for sharing this with us. I noticed IE 8 will render absolutely positioned elements on top of relatively positioned ones, regardless of the z-index you provide.

    Knowing this, I just added a z-index to the (absolutely positioned) container, which prooved enough to bring the (relatively positioned) child element on top.

    This saved me a lot of work. Good one!

  • Al Stevens Says:

    Thanks for sharing this and giving me the afternoon off. Sweet :)

  • C#Guy Says:

    Epic! :)

    Solved my z-index, menu disappear bugg right away.

  • phale Says:

    Thanks

    But if my control is in orther control, I have to set the z-index of the top parent

  • Thomas Says:

    Thanks! Parent within Parent within Parent…Finally I found the element that was relatively positioned and it didn’t have a z-index defined! Thought it was related to menu’s javascript fallback or even related to PNG fix.

  • Brad Says:

    You are the man! Thanks!

  • Elron Says:

    This is actually working!!!
    I searched for a solution a long time ago.

    Thank you!

  • Bill Says:

    Thank you so much.

    I have been searching for hours and hours for a solution!

  • Rodrigo Surrey Says:

    good info. i possess had my area for regarding 8 weeks and it does not show up in google.. all of my back links do, well only some as of recently, the rest dont seem to be showing.. i possess asked for a recinlusion and they have not made it crystal clear regardless of whether it is banned or not, having said that my sitemap and all my webpages say that they are indexed but still do not display to up.. its very difficult to say what is going on.

  • Mike Says:

    Looks simple enough – any idea why it’s not working in IE7… does anybody use IE7 any more?

  • Ronny Says:

    Thanks, It worked great for me.

  • Gopi Sundharam Says:

    Ah, that was the trick! Thanks. It worked on IE7 perfectly. Wish businesses adopt new browser versions soon! :)

  • Homer Goltz Says:

    I just wanted to tell you how much we like the information you posted on your blog about this topic. Its nice to see this topic posted about on websites.

Leave a Reply