How does transform-origin change the result of a CSS rotation?
Quick answer
transform-origin sets the point an element rotates around. For ordinary CSS elements, the default is the center; changing it to a corner makes that corner the pivot instead. The rotation angle stays the same, but the element follows a different path and ends up in a different visual position. Set the origin explicitly when you need a predictable pivot. [S1]
The question, the details, the next step.
A practical checklist
Identify the point that should act as the pivot.
Set
transform-originexplicitly instead of relying on the default.Compare examples with the same dimensions and rotation angle.
Check the visual result in the element’s actual layout.
If working with SVG, verify how its reference box and initial behavior apply.
A few more useful answers
What is the default `transform-origin` for an ordinary CSS element?
It is the center, 50% 50% 0, for ordinary CSS transformable elements. SVG can differ in some cases. [S1]
Do percentages in `transform-origin` refer to the page?
Sources
References used for this guide.
- [S1] MDN: transform-origin CSS property developer.mozilla.org · Checked
- [S2] W3C: CSS Transforms Module Level 1, rendering model and transform origin w3.org · Checked
