Transform the element along with x-axis using CSS



Use the translateX(n) method to transform the element along with x-axis.

Let us see the syntax

translateX(n)

Here, n is a length representing the abscissa of the translating vector.

Let us see an example

div {
   width: 50px;
   height: 50px;
   background-color: black;
}
.trans {
   transform: translateX(20px);
   background-color: orange;
}

Advertisements