CSS transform-origin Property Last Updated : 04 Aug, 2023 Comments Improve Suggest changes Like Article Like Report 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 | inheritProperty 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 html <!DOCTYPE html> <html> <head> <style> .outer { margin: 50px; border: 1px dotted; position: relative; height: 100px; width: 400px; background-color: lightgreen; } .box { position: absolute; border: 1px solid; background: url( "https://write.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-logo.png") no-repeat; background-size: cover; height: 100px; width: 400px; transform: rotate(15deg); transform-origin: 10px 30px; } </style> </head> <body> <h1>CSS transform-origin Property</h1> <p> The CSS transform-origin Property is used to set the origin of the element's transformation </p> <div class="outer"> <div class="box"></div> </div> </body> </html> Output: Example 2: Specifying the position in percentage html <!DOCTYPE html> <html> <head> <style> .outer { margin: 50px; border: 1px dotted; position: relative; height: 100px; width: 400px; background-color: lightgreen; } .box { position: absolute; border: 1px solid; background: url( "https://write.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-logo.png") no-repeat; background-size: cover; height: 100px; width: 400px; transform: rotate(15deg); transform-origin: 50% 75%; } </style> </head> <body> <h1>CSS transform-origin Property</h1> <p> The CSS transform-origin Property is used to set the origin of the element's transformation </p> <div class="outer"> <div class="box"></div> </div> </body> </html> Output: Example 3: Specifying the position in keywords html <!DOCTYPE html> <html> <head> <style> .outer { margin: 50px; border: 1px dotted; position: relative; height: 100px; width: 400px; background-color: lightgreen; } .box { position: absolute; border: 1px solid; background: url( "https://write.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-logo.png") no-repeat; background-size: cover; height: 100px; width: 400px; transform: rotate(15deg); transform-origin: bottom left; } </style> </head> <body> <h1>CSS transform-origin Property</h1> <p> The CSS transform-origin Property is used to set the origin of the element's transformation </p> <div class="outer"> <div class="box"></div> </div> </body> </html> Output: Example: In this example, we are using transform-origin: initial property. html <!DOCTYPE html> <html> <head> <style> .outer { margin: 50px; border: 1px dotted; position: relative; height: 100px; width: 400px; background-color: lightgreen; } .box { position: absolute; border: 1px solid; background: url( "https://write.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-logo.png" ) no-repeat; background-size: cover; height: 100px; width: 400px; transform: rotate(15deg); transform-origin: initial; } </style> </head> <body> <h1>CSS transform-origin Property</h1> <p> The CSS transform-origin Property is used to set the origin of the element's transformation </p> <div class="outer"> <div class="box"></div> </div> </body> </html> Output: Example: In this example, we are using the transform-origin: inherit property. html <!DOCTYPE html> <html> <head> <style> /* this acts as the parent */ .outer { margin: 50px; border: 1px dotted; position: relative; height: 100px; width: 400px; background-color: lightgreen; /* set the property of the parent */ transform-origin: bottom left; } .box { position: absolute; border: 1px solid; background: url( "https://write.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-logo.png" ) no-repeat; background-size: cover; height: 100px; width: 400px; transform: rotate(15deg); /* inherits the property of the parent */ transform-origin: inherit; } </style> </head> <body> <h1>CSS transform-origin Property</h1> <p> The CSS transform-origin Property is used to set the origin of the element's transformation </p> <div class="outer"> <div class="box"></div> </div> </body> </html> Output: Supported Browsers: The browser supported by transform-origin property are listed below: Chrome 36.0Edge 12.0Firefox 16.0Safari 9.0Opera 23.0 Comment More infoAdvertise with us Next Article CSS transform-origin Property sayantanm19 Follow Improve Article Tags : Web Technologies CSS CSS-Properties Similar Reads CSS text-transform Property The text-transform property in CSS is used to control the capitalization of text. It allows you to transform text to uppercase, lowercase, or capitalize the first letter of each word. Syntaxtext-transform: none| capitalize | uppercase | lowercase |initial | inherit; Property ValuesHere are the prope 4 min read CSS transform-style Property The transform-style property is used to specify the children of an element are positioned in 3D space or flattened with respect to the plane of the element. Syntax: transform-style: flat|preserve-3d|initial|inherit; Property Values: flat: This value places the child elements in the same plane as the 3 min read Tailwind CSS Transform Origin This class accepts lots of value in tailwind CSS in which all the properties are covered in class form. This class is used to specify the origin of the rotation of an element. It is the point about which an element is rotated. It can be used for both 2D and 3D rotations. In CSS, we can do that by us 2 min read CSS mask-origin property The CSS mask-origin property determines the positioning reference of a CSS mask image applied to an element using mask-image. It defines where the mask image originates within the element's box model, influencing how the mask is positioned and clipped. Syntax: mask-origin: Keyword values /* Or */ ma 2 min read Tailwind CSS Text Transform This class accepts more than one value in tailwind CSS. All the properties are covered in class form. It is the alternative to the CSS text-transform property. This class is used to control the capitalization of the text. Text Transform classes: uppercase lowercase capitalize normal-case uppercase: 2 min read CSS margin-right Property The margin-right property in CSS is used to set the right margin of an element. It sets the margin area on the right side of the element. Negative values are also allowed. The default value of the margin-right property is zero. Syntax:margin-right: length|auto|initial|inherit;Property Value:length: 3 min read CSS perspective-origin Property The perspective-origin property in CSS is used to define the position at which the user is looking 3D object i.e. the vanishing point of the 3D object. Syntax: perspective-origin: x-axis y-axis|initial|inherit; Property Values: x-axis: It represents the horizontal position of the perspective origin. 2 min read Tailwind CSS Transform This class accepts lots of value in tailwind CSS in which all the properties are covered in class form. This class is used to control the transform behavior of any element. In CSS, we can do that by using the CSS transform property. Transform Classes: transform: To perform any transformation you hav 1 min read Fabric.js Text originY Property In this article, we are going to see how to change the originY of the text canvas using Fabric.js. The canvas means the text written is movable, rotatable, resizable, and can be stretched. Further, the text itself cannot be edited like a textbox. To make it possible, we are going to use a JavaScript 2 min read Fabric.js Text originX Property In this article, we are going to see how to change the originX of the text canvas using Fabric.js. The canvas means the text written is movable, rotatable, resizable, and can be stretched. Further, the text itself cannot be edited like a textbox. To make it possible, we are going to use a JavaScript 2 min read Like