Use the translateY(y) method to transform the element using y-axis.
Let us see the syntax −
translateY(y)
Here,
- y: It is a length representing the ordinate of the translating vector.
Let us see an example:
div {
width: 40px;
height: 40px;
background-color: black;
}
.trans {
transform: translateY(20px);
background-color: orange;
}