Internet Explorer z-index bug?

后端 未结 6 762
予麋鹿
予麋鹿 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:34

    I had a real pain with this problem that this particular workaround wasn't relevant for. It's a little hard to explain so I'll try using code:

    In between
    In the back
    Foreground

    The problem is that setting the parent's z-index to a higher value would move it to the foreground instead of the back where its supposed to be. I stumbled upon a solution completely by accident: I made a copy of the foreground element (id=third) outside its parent.

    In between
    In the back
    Foreground

    Its worth mentioning that in my original code the elements don't have IDs so I don't suffer from 2 elements sharing the same one and invalidating my HTML.

    I think its safe to classify this weirdness as another bug that happens to help with the original, but it works, at least for me. Hope somebody finds this useful!

提交回复
热议问题