z-index not working with fixed positioning

后端 未结 8 1169
广开言路
广开言路 2020-11-22 03:46

I have a div with default positioning (i.e. position:static) and a div with a fixed position.

If I set the z-index

8条回答
  •  逝去的感伤
    2020-11-22 04:39

    since your over div doesn't have a positioning, the z-index doesn't know where and how to position it (and with respect to what?). Just change your over div's position to relative, so there is no side effects on that div and then the under div will obey to your will.

    here is your example on jsfiddle: Fiddle

    edit: I see someone already mentioned this answer!

提交回复
热议问题