Quick Links
Along with the x and y axes, 3D-Transforms introduce the Z-axis, which enables 3D manipulations. 3D Transforms are quite similar to 2D Transforms.
X-axis 3D Transforms
The following an example shows the x-axis 3D transforms.
Example:
<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>
Edusite.com
</div>
<p>Rotate X-axis</p>
<div id = "myDiv">
Edusite.com.
</div>
</body>
</html>
Y-axis 3D-Transforms
The following an example shows the y-axis 3D transforms:
<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>
Edusite.com
</div>
<p>Rotate Y axis</p>
<div id = "yDiv>
Edusite.com.
</div>
</body>
</html>
Z-axis 3D–Transforms
The following an example shows the Z-axis 3D transforms:
Example:
<html>
<head>
<style>
div {
width: 200px;
height: 100px;
background-color: pink;
border: 1px solid black;
}
div#zDiv {
-webkit-transform: rotateZ(90deg);
/* Safari */
transform: rotateZ(90deg);
/* Standard syntax */
}
</style>
</head>
<body>
<div>
Edusite.com
</div>
<p>rotate Z axis</p>
<div id = "zDiv">
Edusite.com.
</div>
</body>
</html>
Recommended Posts: