YouTip LogoYouTip

Prop Style Transform

# Style transform Property [![Image 8: Style Object Reference](#) Style Object](#) ## Example Rotate a div element: document.getElementById("myDIV").style.transform="rotate(7deg)"; [Try it Yourself Β»](#) * * * ## Definition and Usage The transform property applies a 2D or 3D transformation to an element. This property allows you to rotate, scale, move, or skew an element. * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) Internet Explorer 10 and Firefox support the transform property. Internet Explorer 9 supports an alternative property for this property, which is the msTransform property (for 2D transformations only). Opera, Chrome, and Safari support an alternative property for this property, which is the WebkitTransform property (for both 3D and 2D transformations). * * * ## Syntax Get the transform property: _object_.style.transform Set the transform property: _object_.style.transform="none|_transform-functions_|initial|inherit" ## Property Values | Value | Description | | --- | --- | | none | Defines no transformation. | | matrix(_n,n,n,n,n,n_) | Defines a 2D transformation, using a matrix of six values. | | matrix3d (_n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n_) | Defines a 3D transformation, using a 4x4 matrix of 16 values. | | translate(_x,y_) | Defines a 2D translation. | | translate3d(_x,y,z_) | Defines a 3D translation. | | translateX(_x_) | Defines a translation, using only the value for the X-axis. | | translateY(_y_) | Defines a translation, using only the value for the Y-axis. | | translateZ(_z_) | Defines a 3D translation, using only the value for the Z-axis. | | scale(_x,y_) | Defines a 2D scale transformation. | | scale3d(_x,y,z_) | Defines a 3D scale transformation. | | scaleX(_x_) | Defines a scale transformation by giving a value for the X-axis. | | scaleY(_y_) | Defines a scale transformation by giving a value for the Y-axis. | | scaleZ(_z_) | Defines a 3D scale transformation by giving a value for the Z-axis. | | rotate(_angle_) | Defines a 2D rotation, the angle is specified in the parameter. | | rotate3d(_x,y,z,angle_) | Defines a 3D rotation. | | rotateX(_angle_) | Defines a 3D rotation along the X-axis. | | rotateY(_angle_) | Defines a 3D rotation along the Y-axis. | | rotateZ(_angle_) | Defines a 3D rotation along the Z-axis. | | skew(_x-angle,y-angle_) | Defines a 2D skew transformation along the X- and Y-axis. | | skewX(_angle_) | Defines a 2D skew transformation along the X-axis. | | skewY(_angle_) | Defines a 2D skew transformation along the Y-axis. | | perspective(_n_) | Defines a perspective view for a 3D transformed element. | | initial | Sets this property to its default value. See (
← Prop Style TransformoriginProp Style Textoverflow β†’