CSS3 3D Transforms

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

CSS3 3D Transforms

CSS3 allows you to format your elements using 3D transformations.

Mouse over the elements below to see the difference between a 2D and a 3D transformation:

CSS3 3D Transforms

In this chapter you will learn about 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:

Example

div {
    -webkit-transform: rotateX(150deg); /* Safari */
    transform: rotateX(150deg);

}

The rotateY() Method

The rotateY() method rotates an element around its Y-axis at a given degree:

Example

div {
    -webkit-transform: rotateY(130deg); /* Safari */
    transform: rotateY(130deg);

}

 

The rotateZ() Method

The rotateZ() method rotates an element around its Z-axis at a given degree:

Example

div {
    -webkit-transform: rotateZ(90deg); /* Safari */
    transform: rotateZ(90deg);

}