CSS rotation with respect to a reference point

Viewed 37391

How to rotate an element with respect to a defined point i.e. defined x & y coordinate in CSS (webkit)?

Normally rotation make element's center point as reference.

3 Answers

It is now August 2022, older answers do not include the use of px as mentioned in the documentation.

transform-origin accepts keyboards (left, right, top, bottom, or center), percentage (50%, 69%...) or length describing how far from the left edge of the box the origin of the transform is set.

Therefore transform-origin: 360px 540px; is absolutely fine and works as expected.

Related