CSStransform-origin Property
Example
Set a rotated element's base placement:
transform: rotate(45deg);
transform-origin: 20% 40%;
}
Definition and Usage
Thetransform-origin property allows you to change the position of transformed elements.
2D transformations can change the x- and y-axis of an element. 3D transformations can also change the z-axis of an element.
To better understand thetransform-origin property,view a demo.
Note: This property must be used together with thetransform property.
Tip: To better understand this property for3D transforms,view a demo.
| Default value: | 50% 50% 0 |
|---|---|
| Inherited: | no |
| Animatable: | yes.Read aboutanimatableTry it |
| Version: | CSS3 |
| JavaScript syntax: | object.style.transformOrigin="0 0"Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
| Property | |||||
|---|---|---|---|---|---|
| transform-origin | 36 | 12 | 16 | 9 | 23 |
CSS Syntax
Property Values
| Property Value | Description |
|---|---|
| x-axis | Defines where the view is placed at the x-axis. Possible values:
|
| y-axis | Defines where the view is placed at the y-axis. Possible values:
|
| z-axis | Defines where the view is placed at the z-axis (for 3D transformations). Possible values:
|
| initial | Sets this property to its default value.Read aboutinitial |
| inherit | Inherits this property from its parent element.Read aboutinherit |
Related Pages
CSS tutorial:CSS 2D Transforms
CSS tutorial:CSS 3D Transforms
HTML DOM reference:transformOrigin property

