Internet Explorer z-index bug?

后端 未结 6 767
予麋鹿
予麋鹿 2020-11-27 07:03

How do you overlap an element over another element that is positioned relatively in Internet Explorer? Z-index doesn\'t work, it always appears behind the relatively positi

6条回答
  •  感动是毒
    2020-11-27 07:25

    I had the same problem in an html where many repeated relative positioned divs were blocking absolute positioned div's view. The workaround provided by www.brenelz.com, that I've already used with success wasn't working in this case. So, the following worked for me: I removed the relative positioning from those divs I've mentioned first, then added a CSS to turn those divs on relative when hover. Let me show you the code:

    Before:

    DivThatYouMustHover {
    height: 300px;
    position: relative;
    width: 200px;
    }
    

    After:

    DivThatYouMustHover {
    height: 300px;
    width: 200px;
    }
    DivThatYouMustHover:hover {
    position:relative;
    }
    

    This way the others 'sisters' of that div stay with normal positioning and don't interfere with the layout. It worked very well for me! I hope it helps you too.

提交回复
热议问题