Why is overflow interacting with z-index?

前端 未结 4 594
心在旅途
心在旅途 2021-02-12 20:41

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:17

    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).

提交回复
热议问题