backdrop-filter

Class Description

backdrop-filter

Sets a fully custom backdrop-filter string via --backdrop-filter.

CSS Rules

.backdrop-filter {
  backdrop-filter: var(--backdrop-filter);
}

Usage

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

Responsive

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

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

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

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

CLS Alert

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

.backdrop-filter Sets a fully custom backdrop-filter string via --backdrop-filter.

backdrop-filter-none

Removes all backdrop filters.

CSS Rules

.backdrop-filter-none {
  backdrop-filter: none;
}

Usage

<element class="backdrop-filter-none" />

Responsive

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

<element class="content-after backdrop-filter-none::after" />
.backdrop-filter-none Removes all backdrop filters.