How to put a static div on top of an absolute position div?

前端 未结 6 1852
误落风尘
误落风尘 2020-12-29 18:49

I am building a small web application. I have two divs. One is absolute and the other is static. I am trying to position my static div on top of my absolute one, so that it

6条回答
  •  清酒与你
    2020-12-29 19:23

    if by top you mean z-Index, you can set the style of that div with a higher z-index

    div.divClassName {
       z-Index:100;
    }
    

    edit:

    you can change the z-index of your div, with absolute positioning to a negative, but then you will have to do so for every other element.

    Unless you really have a really good reason to using positioning to static you can change it to relative, and the z-index will have an effect.io have tried it in your code sample and it works fine;

提交回复
热议问题