Why is overflow interacting with z-index?

前端 未结 4 1726
挽巷
挽巷 2021-02-12 20:28

I am trying to understand the rules behind z-index and how it interacts with the overflow property.

I have this html:


  
4条回答
  •  有刺的猬
    2021-02-12 21:13

    Absolute-positioned elements do not contribute to the dimensions of their parents.

    Therefore, the .cell DIV has no content that affects its dimensions, making it 100% wide by 0px high.

    To make the element appear, you'll have to add a height to .cell that will encompass the DIV, in this case 120px (70px top + 50px height).

提交回复
热议问题