The transform-origin property lets you change the position of transformed elements.
The x- and y-axis of an element can be changed for 2D transformations, while 3D transformations can also change the z-axis of an element.
div.tran {
transform: rotate(45deg);
transform-origin: 25% 45%;
}x-axis
Designates where the view is placed at the x-axis. Possible values: left, center, right, length, and %.
y-axis
Designates where the view is placed at the y-axis. Possible values: top, center, bottom, length, and %.
z-axis
For 3D transformations, designates where the view is placed at the z-axis. Possible values: length.
initial
Sets the property to its default value.
inherit
Inherits this property’s value from its parent item.
Have a code example of transform-origin? Submit a codepen.io demo and we'll showcase it here ↴