CSS transform Property
Example
.example1 {
width: 150px;
height: 75px;
background-color: blue;
transform: rotate(20deg);
}
.example2 {
width: 150px;
height: 75px;
background-color: blue;
transform: skewY(20deg);
}
.example3 {
width: 150px;
height: 75px;
background-color: blue;
transform: scaleY(1.5);
}
Hello World!
Meaning
The transform property lets you rotate, scale, skew, or translate an element.
It modifies the coordinate space of the CSS visual formatting model.
Default value: | none |
Inherited: | No |
Animatable: | Yes |
Version: | CSS3 |
JavaScript syntax: |
|
Standard Syntax
transform: none|transform-functions|initial|inherit|revert|revert-layer|unset;
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
none | This is default value. Specifies that no transform should be applied. |
translate(tx,ty) | Moves the element by the given amount along the X and Y-axis. |
translate3d(tx,ty,tz) | Moves the element by the given amount along the X, Y & Z-axis. |
translateX(tx) | Moves the element by the given amount along the X-axis. |
translateY(ty) | Moves the element by the given amount along the Y-axis. |
translateZ(tz) | Moves the element by the given amount along the Z-axis. |
rotate(a) | Rotates the element by the specified angle around the origin of the element, as defined by the transform-origin property. |
rotate3d(x,y,z, a) | Rotates the element in 3D space by the angle specified in the last parameter, around the [x,y,z] direction vector. |
rotateX(a) | Rotates the element by the given angle around the X-axis. |
rotateY(a) | Rotates the element by the given angle around the Y-axis. |
rotateZ(a) | Rotates the element by the given angle around the Z-axis. |
scale(sx,sy) | Scale the width and height of the element up or down by the given amount. The function scale(1,1) has no effect. |
scale3d(sx,sy,sz) | Scales the element by the given amount along the X, Y and Z-axis. The function scale3d(1,1,1) has no effect. |
scaleX(sx) | Scales the element along the X-axis. |
scaleY(sy) | Scales the element along the Y-axis. |
scaleZ(sz) | Scales the element along the Z-axis. |
skew(ax,ay) | Skews the element by the given angle along the X and Y-axis. |
skewX(ax) | Skews the element by the given angle along the X-axis. |
skewY(ay) | Skews the element by the given angle along the Y-axis. |
matrix(n,n,n,n,n,n) | Specifies a 2D transformation in the form of a transformation matrix comprised of the six values. |
matrix(n,n,n,n,n,n, n,n,n,n,n,n,n,n,n,n) | Specifies a 3D transformation in the form of a 4×4 transformation matrix of 16 values. |
perspective(length) | Defines a perspective view for a 3D transformed element. In general, as the value of this function increases, the element will appear further away from the viewer. |
initial | Sets this property to its default value. |
inherit | If specified, the associated element takes the computed value of its parent element animation-delay property. |
revert | Reverts the cascaded value of the property from its current value to the value the property |
revert-layer | Rollback styles to the ones specified in previous cascade layers. |
unset | Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. |
Default CSS Property Values
selectors {
transform: none;
}