CSS translateX() Function

The CSS translateX() function is used to move elements in a two-dimensional space along the x-axis (horizontally).

The translateX() function works like this:

It moves the position of the element on the horizontal plane by the amount provided by t.

Example

Here's an example of using translateX() to move an element horizontally.

Negative Values

You can also provide negative values if required.

Official Syntax

The official syntax of the translateX() function is as follows:

Possible Values

The translateX() function accepts the <translation-value> argument.

The value is a length (e.g. 10px, 10vw, etc) that defines how much the element will move by.

It can can also be a number without a unit identifier. In this case the number gets interpreted as "user unit". A user unit in the the initial coordinate system is equivalent to the parent environment's notion of a pixel unit.

CSS Specifications

Browser Support

The following table provided by Caniuse.com shows the level of browser support for this feature.