Is it possible to have a child element behind his parent element with z-index

前端 未结 5 1168
逝去的感伤
逝去的感伤 2020-12-10 03:54

I would like to know if it possible to have a child element behind his parent element with z-index.

I would like to use the parent div as transparent color layer on

5条回答
  •  [愿得一人]
    2020-12-10 04:17

    While this wouldn't necessarily work in all browsers (especially older ones), the following has worked for me in the past:

    #child {
      position: relative;
      z-index: -1;
      ...
    }
    

    I'm really only suggesting this as a last resort and would still prefer to use any technique other than this, although it might be ideal in your scenario.

提交回复
热议问题