Layout

Isolation

Utilities for controlling whether an element should explicitly create a new stacking context.

Quick reference

Class
Properties
isolateisolation: isolate;
isolation-autoisolation: auto;

Basic usage

Setting the stacking context

Use the isolate and isolation-auto utilities to control whether an element should explicitly create a new stacking context.

  1. <div class="isolate ...">
  2. <!-- ... -->
  3. </div>

Applying conditionally

Hover, focus, and other states

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:isolation-auto to only apply the isolation-auto utility on hover.

  1. <div class="isolate hover:isolation-auto">
  2. <!-- ... -->
  3. </div>

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:isolation-auto to apply the isolation-auto utility at only medium screen sizes and above.

  1. <div class="isolate md:isolation-auto">
  2. <!-- ... -->
  3. </div>

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.