i2tutorials

CSS 3D Transforms

CSS 3D Transforms

 

The CSS 3D transforms facilitate you to move an element to X-axis, Y-axis, and Z-axis. Following is a list of 3D transforms methods.

 

 

The 3D rotateX() method (X-axis rotation):

 

<!DOCTYPE html>
<html>
<head>
<style>
div {
  width: 300px;
  height: 100px;
  background-color: lightpink;
  border: 1px solid black;
color:white;
}
div#myDiv {
  -webkit-transform: rotateX(150deg); /* Safari */
  transform: rotateX(150deg); /* Standard syntax */
}
</style>
</head>
<body>
<div>
This is I2Tutorials
</div>
<div id="myDiv">
This is I2Tutorials
</div>
</body>
</html>

 

OUTPUT:

 

CSS 3D Transforms

 

The 3D rotateY() method (Y-axis rotation):

 

<!DOCTYPE html>
<html>
<head>
<style>
div {
  width: 300px;
  height: 100px;
  background-color:lightpink;
  border: 1px solid black;
}

div#myDiv {
  -webkit-transform: rotateY(150deg); /* Safari */
  transform: rotateY(150deg); /* Standard syntax */
}
</style>
</head>
<body>
<div>
Welcome to I2Tutorials.
</div>
<div id="myDiv">
Welcome to I2Tutorials.
</div>
</body>
</html>

 

OUTPUT:

 

 

 

 

 

 

Exit mobile version