CSS 3D Transform


We can shift elements to the x-axis, y-axis, and z-axis using 3d transforms. The rotation of the element is clearly specified in the example below.


<html>
<head>
<style>
div {
  width: 200px;
  height: 100px;
  background-color: pink;
  border: 1px solid black;
}
div#myDiv {
  -webkit-transform: rotateX(150deg);
  /* Safari */
  transform: rotateX(150deg);
  /* Standard syntax */
}
</style>
</head>
<body>

<div>WebsitesIQ.com</div>
<p>Rotate X-axis</p>
<div id ="myDiv">WebsitesIQ.com</div>

</body>
</html>

Live Demo!


Output:
WebsitesIQ.com

Rotate X-axis

WebsitesIQ.com


3D transformations on the Y-axis

The y-axis 3D transformations are shown in the illustration below.



<html>
<head>
<style>
div {
  width: 200px;
  height: 100px;
  background-color: pink;
  border: 1px solid black;
}
div#yDiv {
  -webkit-transform: rotateY(150deg);
  /* Safari */
  transform: rotateY(150deg);
  /* Standard syntax */
}
</style>
</head>
<body>

<div>WebsitesIQ.com</div>
<p>Rotate Y axis</p>
<div id = "yDiv">WebsitesIQ.com</div>

</body>
</html>

Live Demo!


Output:
WebsitesIQ.com

Rotate Y-axis

WebsitesIQ.com