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;
}

Updated on: 20-Jun-2020

261 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements