The transform-origin CSS3 property lets you modify the position origin for transformations of an element. For example, the transform-origin of the rotate() function is the centre of rotation. A 2D transformed element can change the X- and Y-axis of the element, while a 3d transformed element can also change the Z-axis.

Syntax:

selector { 

         transform-origin: x-axis y-axis z-axis | initial | inherit;

}

Values:

The property values for the transform-origin are these:

  • x-axis; Transforms the position origin of an element by X-axis; Possible values are:
    • left
    • center
    • right
    • length (px, em…)
    • %
  • y-axis; Transforms the position origin of an element by Y-axis; Possible values are:
    • top
    • center
    • bottom
    • length (px, em…)
    • %
  • z-axis; In 3D transformation, it transforms the position origin of an element by Z-axis; Possible values are:
    • length (px, em…)
  • initialinherit
NOTE: Note that examples from this moment on for simplicity reasons may not include proprietary selectors from this point on.

Example

The transform-origin property example:

 

›› go to examples ››