PureDevTools

CSS isolation Property Guide

Master CSS isolation: isolate — sandbox z-index, contain blend modes, isolate components, and understand all stacking context triggers

All processing happens in your browser. No data is sent to any server.

isolation: isolateCreates new stacking context

Behavior

Creates a new stacking context unconditionally. Children's z-index and mix-blend-mode are resolved within this context. Blending stops at the boundary — children cannot blend with elements outside the isolated element.

Use Case

Preventing mix-blend-mode from bleeding outside a component, sandboxing z-index so child modals/dropdowns cannot escape a widget, or ensuring a component's stacking order is self-contained.

isolation: isolate is the only property that creates a stacking context purely for isolation purposes — it does not trigger compositing, transform, or any other side effects.

Example

.component {
  isolation: isolate;
}

mix-blend-mode Containment Demo

Toggle isolation: isolate on the white component to see how blend mode containment works.

Page background (gradient)

.component { isolation: auto }

mix-blend-mode: multiply

Bleeds through to page gradient → different color

Without isolation — the orange box bleeds through to the gradient page background.

You added mix-blend-mode: multiply to a section overlay, and now it’s blending with everything underneath — the navbar, the footer, even elements in other sections. Or a component’s z-index: 999 tooltip is appearing above your modal. Both problems have the same root cause: missing stacking context boundaries. isolation: isolate creates one with a single property — no transform: translateZ(0) hack, no position: relative; z-index: 0 workaround.

Why This Guide (Not Just Adding isolation: isolate Everywhere)

isolation is a one-value property, but understanding when to use it requires understanding stacking contexts — which CSS properties create them, how z-index resolves within vs across contexts, and why mix-blend-mode bleeds through without containment. This guide covers all of that with interactive demos, an analyzer that identifies stacking context issues in your CSS, and a generator for common isolation patterns. Everything runs in your browser.

What is the isolation Property?

isolation has two values: auto (the default) and isolate. Its primary purpose is to contain mix-blend-mode effects and z-index within a component — preventing them from “bleeding out” to affect the surrounding page.

/* Default — no new stacking context */
.element { isolation: auto; }

/* Create a stacking context unconditionally */
.component { isolation: isolate; }

The key difference from other stacking context triggers (like opacity: 0.99 or transform: translateX(0)) is that isolation: isolate only creates a stacking context — it does not trigger compositing, does not affect rendering performance, and has no visual side effects.

The Two Values

isolation: auto

auto is the initial value. The element will not create a new stacking context unless another property forces one (opacity, transform, filter, etc.). This is correct for the vast majority of elements.

.normal-element {
  isolation: auto; /* No new stacking context */
}

With auto, children’s mix-blend-mode blends against anything below the element in the stacking order — including the page background, images behind the element, or sibling elements.

isolation: isolate

isolate forces a new stacking context to be created on the element, regardless of any other properties. This is the value you reach for when you need:

.component {
  isolation: isolate;
  background: white;
}

.component__image {
  mix-blend-mode: multiply;
  /* Now blends against .component's white background */
  /* NOT against the page or elements underneath .component */
}

What is a Stacking Context?

A stacking context is an independent rendering layer in CSS. Elements in different stacking contexts are composited (painted) separately. When a new stacking context is created:

  1. The element and all its descendants form a self-contained group
  2. z-index values inside only compete with each other, not with the global page
  3. mix-blend-mode on children blends against the element’s background, not outside elements
  4. The entire group is painted as a single unit relative to the parent stacking context

The root <html> element always creates the global stacking context. Every other stacking context is nested within it.

What Creates a Stacking Context?

Beyond isolation: isolate, many CSS properties implicitly create stacking contexts as a side effect of their rendering requirements:

Property / ConditionExample
position (not static) + z-indexautoposition: relative; z-index: 1;
opacity < 1opacity: 0.99;
transformnonetransform: translateX(0);
filternonefilter: blur(0px);
backdrop-filternonebackdrop-filter: blur(10px);
mix-blend-modenormalmix-blend-mode: multiply;
will-change (composited prop)will-change: transform;
contain: layout | paint | strict | contentcontain: layout;
clip-pathnoneclip-path: inset(0);
Flex/grid child + z-indexautoz-index: 1; (child of flex)

The problem with implicit stacking context triggers is that they are side effects — you add transform for animation and inadvertently create a stacking context. isolation: isolate makes the intent explicit and keeps the code maintainable.

Common Patterns

1. Containing mix-blend-mode

This is the original motivation for isolation. Without it, mix-blend-mode: multiply on an image will blend with the page background:

/* Problem: image bleeds through card to page background */
.card { background: white; }
.card img { mix-blend-mode: multiply; }

/* Fix: isolate the card */
.card {
  isolation: isolate;
  background: white;
}
.card img {
  mix-blend-mode: multiply;
  /* Blends against white card bg — not the page */
}

2. Z-Index Sandboxing

Prevents the z-index “arms race” where components keep increasing their z-index values trying to appear above each other:

/* Without isolation: z-index competes globally */
.widget .dropdown { z-index: 9999; }
.modal { z-index: 10000; }

/* With isolation: z-index is sandboxed */
.widget { isolation: isolate; }
.widget .dropdown { z-index: 50; } /* Scoped to .widget */
.modal { z-index: 100; } /* Separate context — always wins */

3. Component Isolation

Make reusable components predictable in any context:

/* Component root — self-contained stacking */
.date-picker {
  isolation: isolate;
  position: relative;
}

.date-picker__calendar {
  position: absolute;
  z-index: 10; /* Only competes inside .date-picker */
  top: 100%;
}

4. Explicit vs. Accidental Stacking Contexts

When you add transform for animation, you accidentally create a stacking context. Declaring isolation: isolate makes the intent clear:

/* Accidental stacking context */
.animated-card {
  transition: transform 0.2s;
}
.animated-card:hover {
  transform: translateY(-4px); /* Side effect: stacking context */
}

/* Explicit + accidental: clear intent, same behavior */
.animated-card {
  isolation: isolate; /* Intentional stacking context */
  transition: transform 0.2s;
}
.animated-card:hover {
  transform: translateY(-4px);
}

How isolation Differs from Other Approaches

ApproachCreates Stacking ContextVisual Side EffectCompositing Layer
isolation: isolateYesNoneNo
opacity: 0.99YesSlightly transparentYes
transform: translateX(0)YesNoneYes
will-change: transformYesNoneYes (pre-allocated)
position: relative; z-index: 1YesNoneNo

isolation: isolate is the cleanest approach because it only creates a stacking context with no rendering side effects and no unnecessary compositing layers.

Debugging with Browser DevTools

When debugging stacking context issues in Chrome DevTools:

  1. Elements panel → Select the element → Layers tab to see compositing layers
  2. Look for the purple “Promoted Layer” indicator in the Elements panel
  3. In Firefox DevTools, 3D View (under Layout) shows the stacking context hierarchy visually

Common symptoms that suggest a missing isolation: isolate:

Browser Support

isolation has excellent support across all modern browsers:

BrowserVersionSupport
Chrome41+Full
Edge79+Full
Firefox36+Full
Safari8+Full
iOS Safari8+Full

Browser support is effectively 100% for any modern web application. There is no need for fallbacks.

Frequently Asked Questions

Does isolation: isolate affect performance? No. Unlike transform: translateX(0) or will-change: transform, isolation: isolate does not promote the element to its own compositing layer. It creates a stacking context purely in the CSS stacking model without GPU compositing overhead.

Why use isolation: isolate instead of z-index? z-index only works on positioned or flex/grid children and it competes globally within the nearest stacking context. isolation: isolate creates a new stacking context so that z-index values inside the element are scoped and predictable regardless of what other z-index values exist on the page.

Does isolation affect accessibility or semantics? No. isolation is a purely visual CSS property. It has no effect on the DOM, focus order, keyboard navigation, screen reader output, or any other accessibility-related behavior.

Can I combine isolation: isolate with other properties? Yes. isolation: isolate stacks with any other CSS properties. If an element already has opacity < 1 or transform (which create their own stacking context), adding isolation: isolate is redundant but harmless and still communicates intent clearly in the code.

What is the difference between isolation and contain? contain: layout and contain: paint both create stacking contexts as part of a broader containment model that also restricts how layout, paint, and size are calculated. isolation: isolate only affects stacking context — it does not restrict layout or paint containment. Use contain for performance optimization; use isolation purely for stacking/blending containment.

Related Tools

More CSS Tools