VOOZH about

URL: https://www.geeksforgeeks.org/css/css-transform-origin-property/

⇱ CSS transform-origin Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

CSS transform-origin Property

Last Updated : 4 Aug, 2023

The transform-origin property of CSS is used to specify the origin of the rotation of an element. It is the point at which an element is rotated. It can be used for both 2D and 3D rotations. 

Syntax:

transform-origin: position | initial | inherit

Property Values:

  • position: This specifies the position of the origin of rotation. It takes 3 values corresponding to the distance from the left edge of the box, the distance from the top edge of the box, and the z-axis of rotation. The values could be specified in length units, percentages or keywords. The z-axis value is always specified using length units. 
  • initial: This is used to set the property to its default value. 
  • inherit: This is used to inherit the property from its parent. 

Example 1: Specifying the position in length units 

Output:👁 values

Example 2: Specifying the position in percentage 

Output:

👁 percentage

Example 3: Specifying the position in keywords 

Output:👁 keyword-value

Example: In this example, we are using transform-origin: initial property.

Output:👁 initial

Example: In this example, we are using the transform-origin: inherit property.

Output:👁 inherit

Supported Browsers: The browser supported by transform-origin property are listed below:

  • Chrome 36.0
  • Edge 12.0
  • Firefox 16.0
  • Safari 9.0
  • Opera 23.0
Comment
Article Tags: