CSS Tutorial
Menu
CSS Advanced
Menu
CSS Responsive
Menu
CSS Grid
Menu
CSS 3D Transforms
The CSS transform property allows you to use the following 3D transformation methods:
- rotateX()
- rotateY()
- rotateZ()
The rotateX() Method
The rotateX() method is used to rotate an element around its X-axis at a given degree:
HTML
The rotateX() Method
The rotateX() method rotates an element around its X-axis at a given degree.
This a normal div element.
This div element is rotated 150 degrees.
CSS
div {
width: 300px;
height: 100px;
background-color: grey;
border: 1px solid black;
}
#myDiv {
transform: rotateX(150deg);
}
Output

The rotateY() Method
The rotateY() method is used to rotate an element around its Y-axis at a given degree:
HTML
The rotateY() Method
The rotateY() method rotates an element around its Y-axis at a given degree.
This a normal div element.
This div element is rotated 150 degrees.
CSS
div {
width: 300px;
height: 100px;
background-color: grey;
border: 1px solid black;
}
#myDiv {
transform: rotateY(150deg);
}
Output

The rotateZ() Method
The rotateZ() method is used to rotate an element around its Z-axis at a given degree:
HTML
The rotateZ() Method
The rotateZ() method rotates an element around its Z-axis at a given degree.
This a normal div element.
This div element is rotated 90 degrees.
CSS
div {
width: 300px;
height: 100px;
background-color: grey;
border: 1px solid black;
}
#myDiv {
transform: rotateZ(90deg);
}
Output
