Squish the Internet Explorer Z-Index Bug

Winnipeg Web Design

The Problem

The other day when working on my latest website; I had everything working fine until I decided to check how things looked in IE. Usually IE7 plays pretty well, but in this instance there was a crucial problem. I had an absolutely positioned div (hover menu) and under it I had a transparent PNG that was also absolutely positioned. It looked like following:

IE Z-Index Bug

The Solution

The absolutely positioned div had a z-index of 1000, but @jorenrapini pointed out that IE doesn’t use z-index properly. I came across this quirksmode.org article that explained the flaw in detail:

“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”

The above article does not directly contain a workaround but in the comments a fellow said the following:

giving the parent element a higher z-index actual fixes the bug

I then used the following code on my site:

<div style="position: relative; z-index: 3000">
    <div style="position:absolute;z-index:1000;">
        <a href="#">Page</a>
        ...
    </div>
</div>
<img style="position:absolute" src="myimage.png" />

This gave me the result I was looking for.

Fix Z-Index Bug in IE

Don’t ask me why this works but it does!

If you liked this article please keep updated by subscribing to my RSS feed, and following me on twitter (@brenelz)

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Add to favorites
  • Design Float
  • DZone
  • email
  • FriendFeed
  • PDF
  • Propeller
  • Reddit
  • RSS
  • StumbleUpon
  • Twitter

Related posts:

  1. Internet Explorer Bugs
  2. CSS Line Break Bug (screencast)
  3. CSS/JavaScript Hover Menu (screencast)


Written by Brenley Dueck

 

180 Responses to “Squish the Internet Explorer Z-Index Bug”

  1. Hassan Says:

    February 4th, 2009 at 2:33 am

    Nice trick! Thanks!

  2. Brian Says:

    February 5th, 2009 at 4:21 am

    Good tip, bound to come across it sometime as I have started to use absolute positioned divs now.

  3. SteveG Says:

    February 6th, 2009 at 10:59 am

    I have run into the same problem. My dropdown nav divs would appear behind the main promo div in IE 7 and IE 6. I couldn’t find a solution online at the time. I experimented and ended up using a z-index of -1 on the promo div for IE 7 and lower. That seems to work fine, but I couldn’t tell you why. I’ll try your solution next time.

  4. shin Says:

    February 9th, 2009 at 12:06 pm

    I have the same problem and I almost gave up to fix it. Thanks for 1000 times. I appreciate it and you made my day.

  5. Sean Says:

    February 9th, 2009 at 12:31 pm

    Thanks for the trick!

  6. Josh Says:

    February 9th, 2009 at 12:37 pm

    Wow, great tip! Thanks.

  7. jitendra Says:

    February 12th, 2009 at 8:01 am

    how to solve this problem for internet explorer http://jitendravyas.com/ie6.html

  8. John Says:

    February 14th, 2009 at 9:24 pm

    Thanks for the fast tip.
    I spent around 8 hours trying to fix this thing.
    Although I was trying to do it with a Javascript dynamic iframe and now I’ll do it with a div and with an AJAX call. Thanks to you.
    Good and fast demo.
    Thanks again.

  9. Andrew Says:

    February 16th, 2009 at 2:22 pm

    Thanks for the tip! Saved me a ton of grief.

  10. Joe Says:

    March 13th, 2009 at 7:11 am

    Great! Thanks, it works.

  11. Carl Says:

    March 17th, 2009 at 3:48 pm

    But this will not work in any other browser, since the content in the child div will then be (correctly) positioned behind the contents in the parent div!

  12. Bob Says:

    March 26th, 2009 at 7:14 pm

    Absolutely fantastic. Worked perfectly after trying other hacks with zero success. Many thanks!

  13. David Says:

    April 2nd, 2009 at 6:25 pm

    This post made my day! My divs were all showing up fine in FF and Safari, but disappearing behind the parent div in IE. Thanks for posting and sharing.

  14. Keith Says:

    April 5th, 2009 at 2:50 pm

    The trick works because IE doesn’t allow elements to have a higher z-index than their parent element. It’s actually a reasonable restriction, if somewhat unneccessary (like Mozilla’s insistence that opacity always inherit).

    You can sometimes get around this by taking advantage of the fact that absolutely positioned elements don’t care about their parents (though this can get inconvenient if you’re unfamiliar with your DOM in JS). Simply find a good element to position as relative, then set up independent elements and use the absolute positioning/z-index to put them where you want them.

  15. Nigel Says:

    April 13th, 2009 at 1:54 pm

    Wow – brilliant! You’ve turned my day around from seemingly unending frustration to a successful and happy one. Thank you very much indeed for sharing this neat trick.

  16. Scott Says:

    April 29th, 2009 at 8:35 pm

    Thanks. I also noticed that if you have nested absolutely positioned elements this fix won’t work unless you put the higher z-index on the top most relatively positioned element. In other words don’t just put the higher z-index on the parent element, put it on the first parent that is positioned relatively.

  17. Matthew Howland Says:

    May 5th, 2009 at 7:44 pm

    Thanks for the advice. I had the same problem. It was not just as easy as changing a couple of the indexes, so I wrote a javascript to reindex the divs. All of my stuff was in divs, so it worked. See the code below:

    function reIndex(){
    forms = document.forms
    zi = 2000;
    cn = document.getElementsByTagName(‘div’);
    for (n=0;n<cn.length;n++){
    cn[n].style.zIndex=zi–
    }
    }

    Thought this may help someone else.

    Matt

  18. Matthew Howland Says:

    May 5th, 2009 at 7:46 pm

    I forgot to mention, you call this after everything has already loaded.

  19. Bjorn Thomson Says:

    May 15th, 2009 at 5:18 pm

    Thank you! Hours of work dropped to a couple of minutes of tweaking…

  20. tison Says:

    May 22nd, 2009 at 2:37 pm

    Unfortunately both my divs were children of the same element, so luckily:

    @SteveG – thank you! Giving the second element a z-index:-1 worked :) ,

    Honestly, can’t calculate the time i’ve wasted on this browser…

  21. Z-index Internet Explorer IE6 | breakthrough design Says:

    May 22nd, 2009 at 2:45 pm

    [...] Give the element (that should be behind) a z-index:-1 [...]

  22. Rob Says:

    June 2nd, 2009 at 2:41 pm

    Really neat trick, cheers!

  23. Andrew Champ Says:

    June 8th, 2009 at 3:17 pm

    THANK YOU SO MUCH! SPENT 2 DAYS (16 HRS) TRYING TO FIX, THIS DID THE TRICK!

    .andrew champ

  24. avramir Says:

    June 19th, 2009 at 7:38 am

    man, thank you so much!!!

  25. Rival Says:

    June 25th, 2009 at 5:53 am

    Wow, thanks a lot!

  26. Barbara Says:

    June 28th, 2009 at 6:02 pm

    Thank you for this fix, this one worked for me! I have included it in my binder of potential workarounds for the IE z-index bug:
    http://www.livebinders.com/play/play?id=1808

  27. Alaa Al-Hussein Says:

    July 6th, 2009 at 5:05 am

    I had the same problem.. I added the z-index property to css of the main div and it work.

    I am waiting for the day to stop working on IEs

    Thanks.

  28. Tyron M. Says:

    July 22nd, 2009 at 5:07 am

    I had the same problem. A menu that opens up and was hidden behind the main content window.

    But adjusting z-index on any element did not help. I got it fixed however, my problem was that my parent element had overflow:hidden;
    Watch out for that ;)

  29. Joe Says:

    July 22nd, 2009 at 10:49 am

    THANK YOU!! life saver. :)

  30. Benny Says:

    July 24th, 2009 at 8:52 am

    Thanks – this saved me a lot of time!

  31. Jeff Says:

    July 24th, 2009 at 5:26 pm

    Thanks for the simple fix.

  32. Priyank Says:

    July 25th, 2009 at 1:23 am

    ThanKs!!

  33. Ryan Says:

    July 31st, 2009 at 4:41 pm

    Thanks for the tip. I had to reconfigure my code just a touch to match your example, but it worked great.

  34. Luke Says:

    August 2nd, 2009 at 7:10 pm

    after hours on end searching for a solution…

    THANK YOU!!

    may IE die a slow and painfull death

  35. Joren Rapini Says:

    August 7th, 2009 at 4:00 pm

    Just ran into this problem again, as usual. What Scott wrote earlier is correct – this only works if you are applying it to relative positioned elements – doing it on absolute positioned elements does not help! Stinking IE.

  36. " IE7 et z-index" - CoolCoyote.net Says:

    August 12th, 2009 at 9:01 am

    [...] j’ai trouvé la solution sur ce blog. J’ai résolu le problème en définissant un z-index le plus élevé sur #header. Ce qui [...]

  37. DaCoder Says:

    August 18th, 2009 at 4:59 pm

    Saved my bu++

    Thanks

  38. Andrew Says:

    August 19th, 2009 at 8:26 am

    Thanks for this… sorted out my issue in an instant!

  39. Glenn Says:

    August 20th, 2009 at 1:39 pm

    Thanks you so much.
    Helped me on my Crewe United Football Club drop down menu.

  40. pradnya Says:

    September 3rd, 2009 at 5:14 am

    thank you very much….
    It’s help me lots…

  41. Arly Says:

    September 5th, 2009 at 7:47 am

    really this helps me a lot after 2 hours crazy-ing around with IE.

    THANKS!

  42. johnmark Says:

    September 7th, 2009 at 8:06 am

    Why the hell doesnt microsoft IE conform to CSS standards like all other browsers?
    This goes to show that opensource is the way to go…
    Long live firefox…

  43. Ben Says:

    September 9th, 2009 at 2:44 am

    I’ve been searching for this solution for such a long time.

    Thank you very much!

  44. ian Says:

    September 12th, 2009 at 8:47 pm

    Life saver, thankfully you were the first hit on Google.
    You just got me out of a jam, thanks again

  45. Sarah Says:

    September 18th, 2009 at 5:58 am

    Thanks very much…perfect.

  46. Ricky Says:

    September 18th, 2009 at 11:26 am

    Keith was close when identifying the problem, but wrong.

    The issue is that when you give a z-index to a container, it restarts the z-indexing inside of it at 0, and the global-level z-index of everything inside the container becomes the same as the parent.

    When you have a container without a z-index, it gets a value of ‘auto’ and *shouldn’t* affect the z-indexing of anything inside of it.

    However when internet explorer finds a relatively positioned element with a z-index of ‘auto’, it treats it like it has z-index of ‘zero’, thus restarting the z-indexing inside that container. From that point, everything inside that container has a global-level z-index value of 0.

    Your solution worked because the menu aquired a global-level z-index that was the same as its container, which was in turn higher than the image of the car.

    To illustrate this, you could give the car a z-index of 500, and change the ’1000′ z-index with a value of ’1′ and it would still work.

  47. Okada Design Blog » Blog Archive » z-index problem with IE Says:

    September 29th, 2009 at 10:12 am

    [...] This article helped me how to solve IE z-index problem. There is a good comment at the end as well.Title is called Squish the Internet Explorer Z-Index Bug and written by Brenelz Web Solutions.http://www.brenelz.com/blog/2009/02/03/squish-the-internet-explorer-z-index-bug/ [...]

  48. Pete Says:

    October 14th, 2009 at 6:26 pm

    I spent a few hours on this last night and was ready to lose my mind when I found your tip. Other developers have posted complex javascript solutions online, but this solved my problem quickly. Thanks!!

  49. Jess Says:

    October 22nd, 2009 at 3:38 pm

    that’s so simple that makes me feel stupid for wasting so much time trying to fix it.

    thank you very much :)

  50. JW Says:

    October 25th, 2009 at 4:49 pm

    This was tweaking me off big-time. Thank you so much for the fix. Your solution was the simplest one for this ridiculous problem. Thanks again!

  51. Lloyd Armbrust Says:

    November 4th, 2009 at 12:26 am

    Awesomesauce. I was about to kill someone before finding this fix. You rock it.

  52. Greg Says:

    November 10th, 2009 at 3:55 am

    Hi,
    it’s nice solution but not worked for me.
    I have same case with menu,but under menu I have tabs. The issue with relative z-index -1 make tabs unavailable.
    Finally I did my solution with Jquery and relative position:

    jQuery().ready(function(){
    $(".slidemenu").hover(
    function(e) {
    $('#neg_position').css("z-index","-1").css("position","relative");
    },
    function() {
    $('#neg_position').css("z-index","").css("position","");
    }
    ).mousemove(
    function(e) {
    $('#neg_position').css("z-index","-1").css("position","relative");
    }
    );
    });

    slidemenu is container of my menu,neg_position my tabs container

    I hope it help to somebody.

  53. timkg» Blog Archive » IE z-index bug Says:

    November 10th, 2009 at 7:46 pm

    [...] But giving a higher z-index to the menu didn’t made it appear on top of the div below it. This post got the solution: the enclosing element of the menu needs a higher z-index than the actual menu. It [...]

  54. Andrew Mason Says:

    November 18th, 2009 at 9:02 am

    Just wanted to say thank you. I was struggling with this bug for a while until I found your post. Cheers.

  55. Jason M. Says:

    November 24th, 2009 at 6:41 pm

    Wow … I spent a couple hours today tryin’ to deal with this same issue. Apparently, not just the parent needs an updated z-index, but so do all the parents! Right up to the HTML tag.

    Thank you for this fix! You saved me hours and hours of time.

  56. Alex Says:

    November 26th, 2009 at 4:54 am

    Hey, this is great, works like a charm!

    Thanks for the easy fix

  57. York Says:

    December 1st, 2009 at 5:37 pm

    thanks mate, it saved me a lot of time~!

  58. Alina Says:

    December 1st, 2009 at 6:15 pm

    I cannot seem to get this to work for this page: http://yogasports.biz

    Can anyone help?

    The dropdowns appear behind the flash animation

  59. Anna Says:

    December 2nd, 2009 at 1:53 pm

    Worked perfectly. Thank you!

  60. Anna Says:

    December 2nd, 2009 at 1:54 pm

    Alina,

    Try making your Flash transparent. Should fix the problem.

  61. dev Says:

    December 3rd, 2009 at 5:42 am

    In addition to what Ricky said, IE always assigns a global z-index of 0 no matter whether the element is relatively or statically positioned whenever its z-index is not specified.

    So, the workaround would be to set a higher z-index of the topmost parent element (immediately inside body) containing the menu.

  62. yenny Says:

    December 6th, 2009 at 9:18 am

    thank you

  63. Ricky Says:

    December 9th, 2009 at 11:15 am

    dev, you’re right, but it is only on relative & absolutely positioned elements. If you remove the position: relative or position: absolute from the parent, the problem goes away. However this is rarely an option that is available.

  64. amrish Says:

    December 10th, 2009 at 3:15 am

    thanks a lot…saved my day :)

  65. Vera Says:

    December 11th, 2009 at 8:12 am

    great tip! now just to squash IE…

  66. Mohammed AbdelRahman Says:

    December 15th, 2009 at 1:56 pm

    saved my time! thanks :)

  67. Frank Says:

    December 15th, 2009 at 9:07 pm

    Thank you so much, that just saved me so much time!

  68. Neal Says:

    December 16th, 2009 at 3:31 pm

    You da man. Thanks!

  69. Internet Explorer Stylesheet Limit | Damian Nicholson Says:

    December 21st, 2009 at 3:28 am

    [...] figure IE  inconsistencies like the double margin bug, png fix and z-index issue all to be common knowledge amongst web developers and designers. But why not this one? Surely the [...]

  70. David McMeans Says:

    December 29th, 2009 at 1:34 pm

    Saved my bacon. Thanks! (I hate ie7)

  71. Jared Says:

    December 29th, 2009 at 2:06 pm

    Thanks! This helped a lot. Also, thanks for the link to the quirksmode page.

  72. Jerome St. Sauver Says:

    January 1st, 2010 at 11:29 pm

    Thank you, Thank you, Thank you.

  73. Prowebdesign Says:

    January 5th, 2010 at 9:32 am

    Scott – you are genious! Excatly what i needed here!

  74. Jason Says:

    January 5th, 2010 at 7:08 pm

    Thanks mate, solved my problem

  75. Flemming Rubak Says:

    January 13th, 2010 at 3:07 am

    Good trick – unfortunately it doesn’t always solve the problem, especially with javascript and flash elements.

    Instead you can stack the parent elements and use position:relative together with z-index. That stacks correctly in all IE versions.

  76. Bart van Irsel Says:

    January 15th, 2010 at 4:15 am

    Thanks a lot!

    This really helped us out. Time for IE7 itself to be squished! ;)

  77. Stanny Says:

    January 15th, 2010 at 12:06 pm

    I think I love you, man ;)

  78. @nomadone Says:

    January 17th, 2010 at 7:20 am

    Thank you so much, life saver, been struggling with this for ages now. Your solution worked, so quick & easy.

  79. Aleksandar Says:

    January 19th, 2010 at 3:19 am

    Thank you…

  80. mccormicky Says:

    January 19th, 2010 at 10:50 pm

    The plague of my existence, squished!!!

  81. eg Says:

    January 20th, 2010 at 6:03 pm

    There’s 2 days of my life I won’t get back…

    So quick, so easy, so works in every browser. Thanks!

  82. Sam Says:

    January 21st, 2010 at 12:45 am

    Thanks heaps, life saver :)

  83. Sushil Kumar Raghav Says:

    January 25th, 2010 at 8:27 am

    Thanks Bro… its really work.. :)

    Keep it up bro.. :)

  84. vedran Says:

    January 27th, 2010 at 4:13 am

    This solve my problem. Thanks a lot!

  85. Revisiting the HTML image map « Work with ChoiceCuts Says:

    January 27th, 2010 at 8:53 am

    [...] Map due to IE not co-operating when I put a drop-down menu on the same page. This article from Brenelz Web Solutions saved the [...]

  86. Colby Wright Says:

    January 29th, 2010 at 1:38 am

    Just wanted to say thanks for this tip. Its so simple but really works.
    Thank you.

    Colby Wright

  87. Kley Says:

    February 5th, 2010 at 12:50 am

    I am going crazy here. Where do I actually put this code? In the body html or in some js file? I have no idea where to put the code and I have tried everything but the menu still displays behind the graphic. Please I need help

  88. Sådan fixes IE7’s z-index bug med jQuery » Netsans Says:

    February 9th, 2010 at 5:51 am

    [...] løste ikke umiddelbart mit problem. Jeg havde imidlertid andetsteds læst, at man skulle kunne løse problemet ved at give det relativt positionerede forfade…, end det absolut positionerede [...]

  89. Internet Explorer 7 Z-index Bug | Mvied Designs Says:

    February 9th, 2010 at 11:59 am

    [...] I found a pretty good example of this bug in this article – Squish the Internet Explorer Z-Index Bug | Brenelz Web Design Solutions [...]

  90. Tim Says:

    February 10th, 2010 at 9:12 pm

    Wow you rock, finally found a solution!

  91. Mark Says:

    February 11th, 2010 at 1:17 pm

    My Thanks as well – I basically walked every node up from my Navigation DropDown and added one to the z-index or added it if it was not ther to every CSS item up the tree in my IE7 Override css and my IE 6 overrides. I then removed each one until I found the one that mattered – about 20 minutes total after 3 days of trying to solve…. Was the first node even with mine

  92. Dizzle Says:

    February 16th, 2010 at 3:20 pm

    Thank you for posting a straight forward solution with example, everyone else likes to point out they are aware of the bug don’t don’t bother sharing how they fixed it!

  93. Nikita Sumeiko Says:

    February 18th, 2010 at 4:14 am

    Thanks a lot. Really helped!

  94. Nikita Sumeiko Says:

    February 18th, 2010 at 4:15 am

    Also twitted your post here:
    http://twitter.com/manakor/status/9277818368

  95. m.a.c.h.designs Says:

    February 19th, 2010 at 10:33 am

    Simply thankyou!

    damn it I hate IE!

  96. Jeff G Says:

    February 19th, 2010 at 4:46 pm

    I love you! I had read through 5 other answers on other forums, etc, and nothing worked. Thanks, man!

  97. jappe liljedahl Says:

    February 22nd, 2010 at 1:51 pm

    thanks it solved my problem

  98. Jody Says:

    February 24th, 2010 at 4:25 pm

    Still not working…I’ve changed every z-index in my CSS file back and forth and the dropdown still does behind the div. In Firefox too. *sob*

  99. Joey G Says:

    February 24th, 2010 at 6:35 pm

    Like everyone else here I am very thankful for the nice job you did on this and the other solutions. I never would have thought that one bug would get so many people. I am lucky that I didn’t spend as much time as some of these people thanks to your site!

    Much Appreciation!!!

  100. Teresa Hardy Says:

    February 24th, 2010 at 8:15 pm

    That actually worked for me on two divs that weren’t even positioned absolute, but relative. Thank you, you saved my evening!

  101. ken Says:

    February 25th, 2010 at 2:39 pm

    I remember this was working for me, too, once in a while but today for whatever reason is not. Keep trying.

  102. Jonny Says:

    March 3rd, 2010 at 5:11 am

    Thank you! I had forgot how to fix this bug and after reading your solution I’ve fixed it in no time!!
    Great!

  103. Gaby Says:

    March 4th, 2010 at 7:17 pm

    life saving … thanks a lot ..

  104. Vicki Says:

    March 5th, 2010 at 10:46 am

    Thanks so much for this.

  105. Marcysecrets Says:

    March 11th, 2010 at 8:38 am

    Fantastic tip. After 4 days of frustration, Im half way getting it to work based on your solution. My left menu subitems flyout to the right and overlap content on the right but still ‘underlaps’ the content below. A little more tweaking I guess but nearly there.
    Wish you had some adsense ads I could click to say thanks.
    Well, very many thanks.

    Awardebooks.com, DigitalProductStore.com

  106. Haluk Says:

    March 12th, 2010 at 4:37 pm

    Worked great for me! Thanks a lot!

  107. Web Design Maidstone Says:

    March 15th, 2010 at 1:03 am

    Great tips, was struggling on this!

  108. Mariani Mirko Says:

    March 18th, 2010 at 3:32 pm

    Thanks a lot from an italian web designer…

  109. Dinesh Chanchalani Says:

    March 25th, 2010 at 1:20 pm

    It indeed worked! And indeed, very quirky!
    Thank you, though!

  110. brainox Says:

    March 29th, 2010 at 1:56 pm

    Thanks a lot for 1000 times. You make my day.

  111. Paul Says:

    March 29th, 2010 at 4:42 pm

    just as I readied to throw my computer through the nearest wall, I found this article. Worked like a charm. Thanks!

  112. Dan Says:

    March 31st, 2010 at 6:14 am

    Awesome! Thanks very much. Worked a treat :-)

  113. Scott Richardson Says:

    March 31st, 2010 at 6:46 pm

    Worked a treat for me. Thanks dude.

  114. CBloss Says:

    April 2nd, 2010 at 8:49 pm

    I must thank you a thousand times over. I’m sitting here at work, working really late and frustrated with IE. I ran into this problem today and articles said that “Oh just place z-index around and sooner or later it’ll get it”, but you solved my huge problem easily. THANK YOU!!!

  115. Don Says:

    April 5th, 2010 at 11:56 am

    This worked well for me.

    $(function() {
    if($.browser.msie){
    $('div').each(function(i) {
    if($(this).css('position')!='absolute') $(this).css('zIndex', 1000 - (i * 10));
    });
    }
    })

  116. jack Says:

    April 6th, 2010 at 9:54 am

    Tried all the Javascript fixes – even ventured into Prototype land. Had to set the z-index on the ‘grandparent’ element, and it works a treat.

    Nice one, thanks.

  117. Alan Says:

    April 11th, 2010 at 6:59 am

    I just got a similar issue with IE8, the solution was frustrating simple, set z-indexes on the container div’s, forget about the child elements.

    [div style="z-index: 2;"]Absolutely positioned menus[/div]
    [div style="z-index: 0;"]Content[/div]

    Got the hint here: http://webdemar.com/webdesign/superfish-jquery-menu-ie-z-index-bug/

  118. Julie Says:

    April 12th, 2010 at 3:14 pm

    I wish I had searched for this fix sooner…would have saved me a headache. Thanks for posting.

  119. Jörg Says:

    April 14th, 2010 at 5:24 am

    Thanks a lot! Searched the whole day yesterday, but you are the first workaround to this problem!

  120. Dave Says:

    April 15th, 2010 at 9:20 am

    saved my day! thanks, mate :)

  121. vladh Says:

    April 17th, 2010 at 2:58 pm

    this is a dumb motherfucking problem

  122. Philip Phelan Says:

    April 21st, 2010 at 6:50 am

    Thanks… I HATE MSIE! I waste SO MUCH TIME on it!

  123. gorlok Says:

    April 22nd, 2010 at 12:39 pm

    Thank you so much! MSIE “IS” a bug.

  124. Aamir Afridi Says:

    April 27th, 2010 at 5:52 am

    Thank for the tip. This issue was driving me nuts :/
    And yes no body will ask you why it works like this because everyone know IE specially IE6 who already died :D http://ie6funeral.com/

  125. Dennis Says:

    April 28th, 2010 at 10:33 am

    Had the same problem here – not the first time it occurred. Don’t forget any absolute- or relative positioned element in line. I simple missed the very first element, which was positioned relative; added a higher z-index and am in heaven now. Thanx you guys!

  126. Pierrik Le Gall Says:

    May 1st, 2010 at 2:38 pm

    Thanks a lot for this blog post. It has saved me hours :-) (I had the problem on the language switcher on http://piwigo.org )

  127. Jimba Says:

    May 3rd, 2010 at 10:33 pm

    thanks Buddy!

  128. WebArs Says:

    May 4th, 2010 at 12:05 pm

    Thank you! I thought this problem has no decision :)

  129. Ken Says:

    May 12th, 2010 at 9:32 pm

    Thanks! Worked great for me too.

  130. Gia Says:

    May 17th, 2010 at 3:12 pm

    Thanks, worked great!

  131. Todd Welling Says:

    May 20th, 2010 at 11:02 pm

    Cheers dude. Fixed me up well!
    IE blows pretty hard…
    I think there should be a movement to actually STOP sites loading in IE, and force users to use FF or other if they want to view your site…. if only we could.

  132. Suresh Selvaraj Says:

    May 26th, 2010 at 7:27 am

    Thank U Buddy, you really made my day.

  133. Joel Glovier Says:

    May 26th, 2010 at 9:30 am

    @Alan – thanks for posting:

    “Got the hint here: http://webdemar.com/webdesign/superfish-jquery-menu-ie-z-index-bug/

    I tried the suggestion on this page but it didn’t work for me. However, when I went to that link you shared and applied my z-index to the “header” div and the “mainConent” div, all is well now.

    But thanks just the same to this author for your fix, and may God give us all grace who have to support IE.

    (site with my issue in question: http://betawww.helpcurenow.org)

  134. Amar Says:

    May 28th, 2010 at 7:47 am

    Thanks for your explanation.

  135. pSYeNCe Says:

    May 28th, 2010 at 2:49 pm

    Hey, just wanted to mention that IE8 now handles z-index correctly if it’s not in compatibility mode. Even with this workaround I couldn’t get my menus to work, since setting it to -1 made all my links stop working in Chrome. No idea why. But I found out I was working in compatibility mode in IE, and switching over fixed it.

  136. Roger Hatfield Says:

    May 29th, 2010 at 6:00 pm

    Thanks! I didn’t have much hope this would actually work as I don’t usually get these little IE bugs fixed with just one try, but voila’ it worked the first try. I would have never even thought of applying or changing the parent divs z-index property. Thanks again!

  137. Links and Bits for May 31st — Alex Jones Says:

    May 31st, 2010 at 10:02 am

    [...] Squish the Internet Explorer Z-Index Bug. This helped solve a really odd overlap issue in IE [...]

  138. Simon Says:

    June 1st, 2010 at 11:30 am

    Thanks, had precisely the same issue with an absolutely positioned flyout menu. Solved now! Cheers.

  139. Aroh Says:

    June 2nd, 2010 at 3:49 am

    jQuery().ready(function(){
    $(“.slidemenu”).hover(
    function(e) {
    $(‘#neg_position’).css(“z-index”,”-1″).css(“position”,”relative”);
    },
    function() {
    $(‘#neg_position’).css(“z-index”,”").css(“position”,”");
    }
    ).mousemove(
    function(e) {
    $(‘#neg_position’).css(“z-index”,”-1″).css(“position”,”relative”);
    }
    );
    });

    Works perfectly.

    Thanks Greg :D

  140. Passport web Says:

    June 7th, 2010 at 1:13 pm

    Thanx a million!!!

    Not the only thing in IE that I’ll never understand why it happens…

  141. Charlie Says:

    June 10th, 2010 at 2:45 am

    Cheers, worked a treat

  142. Manzoor Says:

    June 10th, 2010 at 11:48 pm

    Fantastic………Its working properly..Thanks for your post…

  143. Tampa Website Design Says:

    June 17th, 2010 at 7:01 am

    Thanks! This worked great for me..

  144. avd Says:

    June 21st, 2010 at 10:15 pm

    Don’t elements have to be positioned to use z-index? And even if the parent element is, this doesn’t work. Sorry.

  145. Kelly Says:

    June 22nd, 2010 at 10:34 am

    Oh!! Perfect! Exactly what I was looking for. You just saved me from so much frustration. Thanks!

  146. http://weblog.hamsterdesign.si/ Says:

    June 28th, 2010 at 2:11 am

    Good tip for work-around. I had to use z-index with – (minus) value to get it work in IE, otherwise IE was refusing to send DIV in background. Ah, naughty IE!

  147. seb Says:

    June 30th, 2010 at 12:42 pm

    saved my evening. some beer is reservated for you if you are around germany once…

  148. Satan Says:

    July 2nd, 2010 at 4:40 am

    Your solution sucks! The problem is the attribute “relative” in my general wrapper div.

  149. Steve Castro Says:

    July 2nd, 2010 at 10:36 am

    Solution worked perfectly. I used it for the navigation drop down.

  150. Gary Says:

    July 6th, 2010 at 9:08 am

    Don’t you just love the internet. I had this exact same problem and was wracking my brains. Thanks for hi-lighting the solution. Harmony has once again been restored!

  151. werejo Says:

    July 6th, 2010 at 8:36 pm

    A year later and you are still saving people’s asses with this!

    Great job!

  152. Bathlamos Says:

    July 8th, 2010 at 1:16 pm

    Hi,

    I’m having difficulties finding a solution to my z-index problem. In my page, the class .txtWrapper should contain both .txtWrapperOFF, a textbox and .txtWrapperHover. txtWrapper OFF should be under the txtWrapperHover class and the textbox should be on top of all. However, it doesn’t display correctly in IE.

    .txtWrapper{
    height:22px;
    width:163px;
    background:#006;
    z-index:500;
    position:relative;
    }

    .txtWrapperOFF{
    z-index:100;
    position:absolute;
    background:#909;
    }

    .txtWrapperHover
    {
    white-space:nowrap;
    z-index:150;
    position:absolute;
    background:#0F0;
    height:22px;;
    width:60px;
    }

    .txtDefaultTextBox_Class
    {
    outline:none;
    border:none;
    color:#858582;
    font:Tahoma, Geneva, sans-serif;
    background-color:transparent;
    position:absolute;
    z-index:200;
    margin-left:6px;
    background:#F00;
    }

    $(document).ready(function()
    {

    $(“.txtDefaultTextBox_Class”).ready(function(){

    $(“.txtDefaultTextBox_Class”).wrap($(‘.txtWrapper’));

    });
    });

    $(function () {
    // set opacity to nill on page load
    $(“.txtWrapperHover”).css(“opacity”,”0″);
    // on mouse over
    $(“.txtWrapper”).hover(function () {
    // animate opacity to full
    $(this.getElementsByClassName(“txtWrapperHover”)).stop().animate({
    opacity: 1
    }, 100);
    },
    // on mouse out
    function () {
    // animate opacity to nill
    $(this.getElementsByClassName(“txtWrapperHover”)).stop().animate({
    opacity: 0
    }, 1000);
    });
    });

    Can someone help me please?

  153. Bas Korsmit Says:

    July 8th, 2010 at 2:12 pm

    Thanks a bunch! It’s a pity though, that these kinds of post have to exist.

  154. iPaddisti Says:

    July 14th, 2010 at 8:00 am

    Great!!!! Internet Explorer 6 is a pain in the ass. Thank your for the fix!

  155. IE 6 Z-Index positioning | Samuel R W East Says:

    July 14th, 2010 at 11:15 am

    [...] of my website after bashing my head against a wall i found a solution which was explain here z-index issues. After reading up on this article it gave me a better understanding off the [...]

  156. bokiboka Says:

    July 16th, 2010 at 3:46 am

    Perfect, Thank you

  157. Todd Says:

    July 17th, 2010 at 8:48 pm

    Hey there… I managed to get your fix to work on one site, but can’t get it going for another. Can you take a peak at http://www.thenuts.tv and see why the logo is HIDDEN in IE, as opposed to ontop in FF.

    I’ve done 3 levels of parent z-indexing to try and fix it :(

    Thanks in advance dude…

  158. Todd Says:

    July 17th, 2010 at 9:08 pm

    All sorted – had to take it all the way up to the base level to get it to work.

  159. Paul Says:

    July 18th, 2010 at 6:26 am

    Thank you – this worked a treat and saved me a headache :)

  160. Dan Says:

    July 19th, 2010 at 6:17 pm

    Thank you for the post and keeping in up for over a year! I’ve been trying to figure this out for a couple of hours and finally decided to Google it. Found your post that way. Bravo!

  161. Boobalan Says:

    July 20th, 2010 at 6:13 am

    Hi,

    The technique is really useful to user like me.I mean anti-ie user…..

  162. Graham Says:

    July 21st, 2010 at 7:44 am

    I was having trouble implementing your fix, it was all exactly the same except using SPANS instead of DIVS with no effect what-so-ever.

    A change of elements and my headache is gone!

  163. Stargazer Says:

    July 27th, 2010 at 9:40 am

    To expand on my post earlier, you can find an in-depth look at this bug
    here

  164. Farzan Says:

    August 1st, 2010 at 5:55 am

    Thank you :-) you saved my hairs…

  165. tot2ivn Says:

    August 2nd, 2010 at 8:27 pm

    Great trick man ! Really don’t know why this works !

  166. igrafix Says:

    August 7th, 2010 at 11:31 am

    thank you, thank you, thank you! Just saved me a lot of time. What a great tip, thanks for sharing this.

  167. Navid Says:

    August 10th, 2010 at 11:25 pm

    Thank you so much
    you guide fix my problem

  168. Linkscheucher – 26.07.2010 bis 11.08.2010 - Der Pixelscheucher Says:

    August 11th, 2010 at 12:31 pm

    [...] Squish the Internet Explorer Z-Index BugThe Problem<br /> <br /> The other day when working on my latest website; I had everything working fine until I decided to check how things looked in IE. Usually IE7 plays pretty well, but in this instance there was a crucial problem. I had an absolutely pos var flattr_wp_ver = '0.9.11'; var flattr_uid = '9242'; var flattr_url = 'http://pixelscheucher.de/linkscheucher-26-07-2010-bis-11-08-2010'; var flattr_btn = 'compact'; var flattr_hide = 0; var flattr_lng = 'de_DE'; var flattr_cat = 'text'; var flattr_tle = 'Linkscheucher – 26.07.2010 bis 11.08.2010'; var flattr_dsc = 'Und hier mal wieder ein paar Dinge, die ich las, für gut befand und euch auch noch damit nerve: Google Streetview: Die Stunde der Hypokriten | Just my (2 Cent) | Dennis KnakeSehr wahr Your Design Is Wrong (And Here's Why) ~ Flyosity by Mike Rundle Better Source Safari Extension Battle of the Burgers: American Fast Food Sites Compared | Design ShackLeckere Burger bedeuten nicht immer auch leckere Websites Don’t Be Ugly By Accident! « OkTrends Cross-browser drop shadows using pure CSS — Nick Dunn Simple Tagebücher: Blogdesign auf neuen Wegen! minimalistisch, einfach, blog, micro | daswebdesignblog.de :: Artikel, Tutorials, Freebies und Interviews Das <wbr>-Element in HTML5 • Peter Kröner, Webdesigner & Frontendentwickler Facebook GUI free PSD resource – Surgeworks — Blog 500 Internal Server Error500 Internal Server Error 4 Essential Extensions for Adobe Fireworks Wait till I come! » UK Government says no to upgrading IE6 – who is'; var flattr_tag = 'linkscheucher'; linkscheucherLinktipps [...]

  169. FireRoxy Says:

    August 13th, 2010 at 6:43 am

    i was searching this and i’ve found your page. short and very nice trick:)

  170. kuloh Says:

    August 17th, 2010 at 3:48 am

    very nice trick indeed.. hit the nail on the head. thanks

  171. Joe Says:

    August 18th, 2010 at 5:45 pm

    You sir, are my hero of the day.

  172. Alexander Says:

    August 21st, 2010 at 2:13 am

    Amazing trick. Thanks very much.

  173. Massimo Says:

    August 25th, 2010 at 6:58 am

    Very useful trick… it solves my problem!
    Thanks.

  174. LiNk Says:

    August 26th, 2010 at 12:42 pm

    Perfect.

  175. Timo Says:

    August 31st, 2010 at 2:03 am

    Thanks for the post. I spend hours trying to fix this bug. You made my day.

  176. Jane Says:

    September 1st, 2010 at 8:27 am

    Thank you so much, this help me tremendously!

  177. Mike Says:

    September 1st, 2010 at 9:41 am

    I know you already have lots of thank you posts, but you seriously deserve another! This has been bugging me on 2 sites im developing for ages – perfect, works a charm. Thanks very much!

  178. Matt Garcia Says:

    September 2nd, 2010 at 5:19 am

    I struggled with the same problem for hours! but this works! fantastic!

  179. Georg Says:

    September 2nd, 2010 at 5:50 am

    Thanks for that post. It solved my problem after reading lots of other suggestions!

  180. Dave Says:

    September 2nd, 2010 at 7:00 am

    YEAH, Thanks for the great fix!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
connect with me!