CSS 3D Transforms
CSS 3D Transforms
CSS also supports 3D transformations.
Mouse over the elements below to see the difference between a 2D and a 3D transformation:
In this chapter you will learn about the following CSS property:
transform
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
transform | 36.0 |
10.0 |
16.0 |
9.0 |
23.0 |
CSS 3D Transforms Methods
With the CSS transform
property you can use
the following 3D transformation methods:
rotateX()
rotateY()
rotateZ()
The rotateX() Method
The rotateX()
method rotates an element around its X-axis at a given degree:
The rotateY() Method
The rotateY()
method rotates an element around its Y-axis at a given degree:
The rotateZ() Method
The rotateZ()
method rotates an element around its Z-axis at a given degree:
CSS Transform Properties
The following table lists all the 3D transform properties:
Property | Description |
---|---|
transform | Applies a 2D or 3D transformation to an element |
transform-origin | Allows you to change the position on transformed elements |
transform-style | Specifies how nested elements are rendered in 3D space |
perspective | Specifies the perspective on how 3D elements are viewed |
perspective-origin | Specifies the bottom position of 3D elements |
backface-visibility | Defines whether or not an element should be visible when not facing the screen |
CSS 3D Transform Methods
Function | Description |
---|---|
matrix3d() | Defines a 3D transformation, using a 4x4 matrix of 16 values |
translate3d() | Defines a 3D translation |
translateZ() | Defines a 3D translation, using only the value for the Z-axis |
scale3d() | Defines a 3D scale transformation |
scaleZ() | Defines a 3D scale transformation by giving a value for the Z-axis |
rotate3d() | Defines a 3D rotation |
rotateX() | Defines a 3D rotation along the X-axis |
rotateY() | Defines a 3D rotation along the Y-axis |
rotateZ() | Defines a 3D rotation along the Z-axis |
perspective() | Defines a perspective view for a 3D transformed element |