translateX() CSS Function

Description

The translateX() CSS function shifts the element relative to its original location by a given horizontal value.

Syntax

transform: translate(tx);

Values

  • txHorizontal shift. A positive value shifts to the right, a negative value to the left.
Any length units accepted in CSS are accepted as values ​​- for example, pixels (px), inches (in), points (pt), etc. A positive value shifts to the right, negative to the left. A value of 0 does not change the position of the element.

Example

<img class="translate" src="images/nature.jpg" alt="Nature Image">
.translate {
transform: translateX(80px);
}

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
??????
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
??????