YouTip LogoYouTip

Prop Style Transformorigin

HTML DOM Style transformOrigin Property

HTML DOM Style transformOrigin Property

-- Learning not just technology, but dreams!

JavaScript Reference

Overview (JavaScript and HTML DOM Reference)

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

Style transformOrigin Property

Style Object Reference

Example

Set the base point position of a rotated element:

document.getElementById("myDIV").style.transformOrigin="0 0";

Try it yourself Β»


Definition and Usage

The transformOrigin property allows you to change the position of transformed elements.

2D transformed elements can change the X and Y axes of the element. 3D transformed elements can also change the Z axis of the element.

Note: This property must be used together with the transform property.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Firefox, and Opera support the transformOrigin property.

Internet Explorer 9 supports an alternative property to this one, the msTransformOrigin property (only for 2D transforms).

Chrome, Safari, and Opera support an alternative property to this one, the WebkitTransformOrigin property (can be used for 3D and 2D transforms).


Syntax

Return the transformOrigin property:

object.style.transformOrigin

Set the transformOrigin property:

object.style.transformOrigin="x-axis y-axis z-axis|initial|inherit"

Property Values

Value Description
x-axis Defines where the view is placed on the X-axis. Possible values:
* left
* center
* right
* length
* %
y-axis Defines where the view is placed on the Y-axis. Possible values:
* top
* center
* bottom
* length
* %
z-axis Defines where the view is placed on the Z-axis (for 3D transforms). Possible values:
* length
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical Details

Default Value: 50% 50% 0
Return Value: A string, representing the element's transform-origin property.
CSS Version: CSS3

Related Articles

JavaScript Style Object: transform Property

CSS Reference: transform-origin Property


Style Object Reference

← Prop Style TransformstyleProp Style Transform β†’