Layout
Utilities for controlling whether an element should explicitly create a new stacking context.
Use the isolate
and isolation-auto
utilities to control whether an element should explicitly create a new stacking context.
<div class="isolate ...">
<!-- ... -->
</div>
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.
<div class="isolate hover:isolation-auto">
<!-- ... -->
</div>
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
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.
<div class="isolate md:isolation-auto">
<!-- ... -->
</div>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.