translate

Class Description

translate

Sets X & Y translation via --translate. Scaled. Use [translate] for raw values like 50%.

CSS Rules

.translate {
  --tw-translate-x: calc(var(--spacing) * var(--translate));
  --tw-translate-y: calc(var(--spacing) * var(--translate));
  translate: calc(var(--spacing) * var(--translate));
}

Usage

The .translate class is flagged as a value-driven selector. The variable --translate is required.
<element class="translate" style="--translate: /* value */;" />

Responsive

Prefix .translate utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:translate" style="--md-translate: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="translate:hover" style="--translate-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="translate:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before translate::before" style="--translate-before: /* value */;" />

<element class="content-after translate::after" style="--translate-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="translate=value" />

<!-- Output -->
<element class="translate" style="--translate: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.translate Sets X & Y translation via --translate. Scaled. Use [translate] for raw values like 50%.

[translate]

Applies raw --translate directly to x/y translation. Use translate utilities for scaled movement when available.

CSS Rules

.\[translate\] {
  --tw-translate-x: var(--translate);
  --tw-translate-y: var(--translate);
  translate: var(--translate);
}

Usage

The .[translate] class is flagged as a value-driven selector. The variable --translate is required.
<element class="[translate]" style="--translate: /* value */;" />

Responsive

Prefix .[translate] utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:[translate]" style="--md-translate: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="[translate]:hover" style="--translate-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="[translate]:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before [translate]::before" style="--translate-before: /* value */;" />

<element class="content-after [translate]::after" style="--translate-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="[translate]=value" />

<!-- Output -->
<element class="[translate]" style="--translate: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.[translate] Applies raw --translate directly to x/y translation. Use translate utilities for scaled movement when available.

translate-x

Sets horizontal translation via --translate-x. Scaled.

CSS Rules

.translate-x {
  --tw-translate-x: calc(var(--spacing) * var(--translate-x));
  translate: calc(var(--spacing) * var(--translate-x));
}

Usage

The .translate-x class is flagged as a value-driven selector. The variable --translate-x is required.
<element class="translate-x" style="--translate-x: /* value */;" />

Responsive

Prefix .translate-x utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:translate-x" style="--md-translate-x: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="translate-x:hover" style="--translate-x-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="translate-x:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before translate-x::before" style="--translate-x-before: /* value */;" />

<element class="content-after translate-x::after" style="--translate-x-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="translate-x=value" />

<!-- Output -->
<element class="translate-x" style="--translate-x: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.translate-x Sets horizontal translation via --translate-x. Scaled.

[translate-x]

Applies raw --translate-x directly to horizontal translation.

CSS Rules

.\[translate-x\] {
  --tw-translate-x: var(--translate-x);
  translate: var(--translate-x);
}

Usage

The .[translate-x] class is flagged as a value-driven selector. The variable --translate-x is required.
<element class="[translate-x]" style="--translate-x: /* value */;" />

Responsive

Prefix .[translate-x] utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:[translate-x]" style="--md-translate-x: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="[translate-x]:hover" style="--translate-x-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="[translate-x]:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before [translate-x]::before" style="--translate-x-before: /* value */;" />

<element class="content-after [translate-x]::after" style="--translate-x-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="[translate-x]=value" />

<!-- Output -->
<element class="[translate-x]" style="--translate-x: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.[translate-x] Applies raw --translate-x directly to horizontal translation.

translate-y

Sets vertical translation via --translate-y. Scaled.

CSS Rules

.translate-y {
  --tw-translate-y: calc(var(--spacing) * var(--translate-y));
  translate: calc(var(--spacing) * var(--translate-y));
}

Usage

The .translate-y class is flagged as a value-driven selector. The variable --translate-y is required.
<element class="translate-y" style="--translate-y: /* value */;" />

Responsive

Prefix .translate-y utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:translate-y" style="--md-translate-y: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="translate-y:hover" style="--translate-y-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="translate-y:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before translate-y::before" style="--translate-y-before: /* value */;" />

<element class="content-after translate-y::after" style="--translate-y-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="translate-y=value" />

<!-- Output -->
<element class="translate-y" style="--translate-y: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.translate-y Sets vertical translation via --translate-y. Scaled.

[translate-y]

Applies raw --translate-y directly to vertical translation.

CSS Rules

.\[translate-y\] {
  --tw-translate-y: var(--translate-y);
  translate: var(--translate-y);
}

Usage

The .[translate-y] class is flagged as a value-driven selector. The variable --translate-y is required.
<element class="[translate-y]" style="--translate-y: /* value */;" />

Responsive

Prefix .[translate-y] utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:[translate-y]" style="--md-translate-y: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="[translate-y]:hover" style="--translate-y-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="[translate-y]:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before [translate-y]::before" style="--translate-y-before: /* value */;" />

<element class="content-after [translate-y]::after" style="--translate-y-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="[translate-y]=value" />

<!-- Output -->
<element class="[translate-y]" style="--translate-y: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.[translate-y] Applies raw --translate-y directly to vertical translation.

translate-z

Sets Z-axis translation via --translate-z. Scaled.

CSS Rules

.translate-z {
  --tw-translate-z: calc(var(--spacing) * var(--translate-z));
  translate: calc(var(--spacing) * var(--translate-z));
}

Usage

The .translate-z class is flagged as a value-driven selector. The variable --translate-z is required.
<element class="translate-z" style="--translate-z: /* value */;" />

Responsive

Prefix .translate-z utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:translate-z" style="--md-translate-z: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="translate-z:hover" style="--translate-z-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="translate-z:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before translate-z::before" style="--translate-z-before: /* value */;" />

<element class="content-after translate-z::after" style="--translate-z-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="translate-z=value" />

<!-- Output -->
<element class="translate-z" style="--translate-z: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.translate-z Sets Z-axis translation via --translate-z. Scaled.

[translate-z]

Applies raw --translate-z directly to z-axis translation for 3D depth movement.

CSS Rules

.\[translate-z\] {
  --tw-translate-z: var(--translate-z);
  translate: var(--translate-z);
}

Usage

The .[translate-z] class is flagged as a value-driven selector. The variable --translate-z is required.
<element class="[translate-z]" style="--translate-z: /* value */;" />

Responsive

Prefix .[translate-z] utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:[translate-z]" style="--md-translate-z: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="[translate-z]:hover" style="--translate-z-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="[translate-z]:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before [translate-z]::before" style="--translate-z-before: /* value */;" />

<element class="content-after [translate-z]::after" style="--translate-z-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="[translate-z]=value" />

<!-- Output -->
<element class="[translate-z]" style="--translate-z: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.[translate-z] Applies raw --translate-z directly to z-axis translation for 3D depth movement.

translate-none

Resets translation by setting the translate property to none.

CSS Rules

.translate-none {
  translate: none;
}

Usage

<element class="translate-none" />

Responsive

Prefix .translate-none utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:translate-none" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="translate-none:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="translate-none:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before translate-none::before" />

<element class="content-after translate-none::after" />
.translate-none Resets translation by setting the translate property to none.