Transform the element using x-axis with CSS3


Use the translateX(x) method to transform the element using x-axis.

Let us see the syntax

translateX(x)

Here,

  • x: It is a length representing the abscissa of the translating vector.

Let us see an example

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

Updated on: 21-Jun-2020

80 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements