Why does perspective changes fixed position in CSS?

前端 未结 1 1663
终归单人心
终归单人心 2020-12-06 05:07

In the example of http://jsfiddle.net/sqk3k2nq/ , the elements are set to be fixed at the same position.

HTML:

相关标签:
1条回答
  • 2020-12-06 05:39

    Why does perspective changes fixed position in CSS?

    Because perspective establishes a containing block similar to the way position: relative; does, which is stated in the transform module:

    Perspective

    The use of this property with any value other than none establishes a stacking context. It also establishes a containing block (somewhat similar to position: relative), just like the transform property does.

    Since you're applying a perspective to every div in your example (and top, left properties) each div creates its own containing block and ends up pushed 20px to the right and bottom of the previous div.

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