Why is the floated element overlapping the element below and not the other way round?

后端 未结 4 544
失恋的感觉
失恋的感觉 2021-01-17 03:03



        
4条回答
  •  逝去的感伤
    2021-01-17 03:47

    From MDN's Stacking and float

    For floating blocks the stacking order is a bit different. Floating blocks are placed between non-positioned blocks and positioned blocks

    And it goes on further to say

    If the opacity of the non-positioned block (#p2 in your example) is reduced, then something strange happens: the background and border of that block pops up above the floating blocks, but still under positioned blocks.

提交回复
热议问题