Why does `transform` break `position: fixed`?

前端 未结 1 1540
北荒
北荒 2020-12-01 21:20

Actually I have found what has caused the problem. My question is now why adding transform to your html, body breaks the position: fixed

相关标签:
1条回答
  • 2020-12-01 21:37

    Regarding the why, a quick quote from this article by meyer:

    A transformed element creates a containing block even for descendants that have been set to position: fixed. In other words, the containing block for a fixed-position descendant of a transformed element is the transformed element, not the viewport

    It's a quirky behavior that's been around since 2011.

    0 讨论(0)
提交回复
热议问题