How to set the transform origin to a specific point on the element?

后端 未结 3 2011
萌比男神i
萌比男神i 2020-12-20 17:40

In this example I want to rotate the hammer from its bottom so is there a way to know exactly the right coordinates of a specific point on the element or should I randomly t

3条回答
  •  天涯浪人
    2020-12-20 18:13

    transform-origin:[x][y]

    replace x and y with percentage values like 50% for mid, 0% for start and 100% for ending positions respectively. I’ve made a pen for helping you to understand this once and for all.

    I wrote a complete article here: https://medium.com/@RajaRaghav/understanding-css-transform-origin-property-2ef5f8c50777 with illustrative examples

提交回复
热议问题