transform

Class Description

transform

Sets a fully custom transform string via --transform. E.g. scale(1.5) rotate(45deg).

CSS Rules

.transform {
  transform: var(--transform);
}

Usage

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

Responsive

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

<element class="md:transform" style="--md-transform: /* 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="transform:hover" style="--transform-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="transform: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 transform::before" style="--transform-before: /* value */;" />

<element class="content-after transform::after" style="--transform-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="transform=value" />

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

CLS Alert

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

.transform Sets a fully custom transform string via --transform. E.g. scale(1.5) rotate(45deg).

transform-none

Resets all transform values.

CSS Rules

.transform-none {
  transform: none;
}

Usage

<element class="transform-none" />

Responsive

Prefix .transform-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:transform-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="transform-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="transform-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 transform-none::before" />

<element class="content-after transform-none::after" />
.transform-none Resets all transform values.

transform-gpu

Forces GPU acceleration via translateZ(0). Promotes element to its own compositor layer.

CSS Rules

.transform-gpu {
  transform: translateZ(0) var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y);
}

Usage

<element class="transform-gpu" />

Responsive

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

<element class="md:transform-gpu" />

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="transform-gpu: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="transform-gpu: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 transform-gpu::before" />

<element class="content-after transform-gpu::after" />
.transform-gpu Forces GPU acceleration via translateZ(0). Promotes element to its own compositor layer.

transform-cpu

Forces CPU processing. Opts out of GPU compositing.

CSS Rules

.transform-cpu {
  transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y);
}

Usage

<element class="transform-cpu" />

Responsive

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

<element class="md:transform-cpu" />

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="transform-cpu: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="transform-cpu: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 transform-cpu::before" />

<element class="content-after transform-cpu::after" />
.transform-cpu Forces CPU processing. Opts out of GPU compositing.