Computer >> Computer tutorials >  >> Programming >> CSS

Transform the element using z-axis with CSS3


Use the translateZ(z) method to transform the element using z-axis.

Let us see the syntax

translateZ(z)

Here,

z: It is a length representing the z-component of the translating vector.

Let us see an example

div {
   width: 40px;
   height: 40px;
   background-color: black;
}
.trans {
   transform: perspective(400px) translateZ(100px);
   background-color: orange;
}