isolation

Class Description

isolate

Sets isolation: isolate. Creates a new stacking context.

CSS Rules

.isolate {
  isolation: isolate;
}

Usage

<element class="isolate" />

Responsive

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

<element class="md:isolate" />

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

<element class="content-after isolate::after" />
.isolate Sets isolation: isolate. Creates a new stacking context.

isolation-auto

Sets isolation to auto, removing forced creation of a new stacking context.

CSS Rules

.isolation-auto {
  isolation: auto;
}

Usage

<element class="isolation-auto" />

Responsive

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

<element class="md:isolation-auto" />

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="isolation-auto: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="isolation-auto: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 isolation-auto::before" />

<element class="content-after isolation-auto::after" />
.isolation-auto Sets isolation to auto, removing forced creation of a new stacking context.