CSS isolation Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Effects & Layers

What You’ll Learn

The isolation property controls whether an element creates a new stacking context. Use it to keep child layers predictable and prevent unexpected overlap with the rest of the page.

01

Stacking

Layer control.

02

auto

Default value.

03

isolate

Force new context.

04

z-index

Related concept.

05

Blend Modes

Common pairing.

06

Components

UI wrappers.

Introduction

The isolation property in CSS determines whether an element should create a new stacking context. Stacking contexts control how overlapping elements are painted and how z-index values compete with each other.

By controlling isolation, you can manage how elements overlap and interact visually within a layout, which helps prevent surprising layering bugs in complex interfaces.

Definition and Usage

Apply isolation: isolate on a wrapper when you want the element and its descendants to stack as one isolated group. This is especially helpful for components that use negative z-index, decorative backgrounds, or mix-blend-mode.

💡
Beginner Tip

Think of isolation: isolate as putting a component inside its own layer group. Child layers stay inside that group instead of leaking into the page behind it.

📝 Syntax

The syntax for the isolation property accepts one of two keyword values:

syntax.css
element {

  isolation: auto | isolate;

}

Basic Example

isolation-basic.css
.card {

  position: relative;

  isolation: isolate;

}



.card::before {

  content: "";

  position: absolute;

  z-index: -1;

  inset: 0;

  background: #fbbf24;

}
isolation: auto; isolation: isolate;

Default Value

The default value of the isolation property is auto. The browser creates a stacking context only when other properties such as z-index, opacity, transform, or filter require it.

Syntax Rules

  • Only two values: auto and isolate.
  • isolate always creates a new stacking context.
  • The property is not inherited.
  • Often paired with position: relative on component wrappers.
  • Useful with negative z-index and mix-blend-mode.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toAll elements
InheritedNo
AnimatableNo
Common useComponent layer grouping

💎 Property Values

ValueDescription
autoThe browser decides whether a new stacking context is needed. This is the default behavior.
isolateExplicitly creates a new stacking context so the element and its descendants are isolated from outside layers.

What Is a Stacking Context?

A stacking context is a group of elements that stack together as one unit relative to elements outside the group:

  • Without isolation — a child with z-index: -1 may render behind ancestor backgrounds or page content in unexpected ways.
  • With isolation: isolate — negative z-index children stay behind the wrapper’s own background but do not escape the component.
  • Blend modes — isolation limits mix-blend-mode blending to the component instead of the whole page.
🔄
Related Properties

Other properties can also create stacking contexts, including z-index, opacity below 1, transform, and filter. isolation: isolate gives you explicit control without changing those visuals.

👀 Live Preview

A card with isolation: isolate and a decorative ::before layer at z-index: -1:

Gradient stays inside

Examples Gallery

Contain negative z-index layers, limit blend modes, compare auto behavior, and wrap a component for predictable stacking.

🔢 Stacking Context Basics

See how isolation keeps internal layers from escaping a component.

Example 1 — Contain Negative z-index

Compare a card with isolation: isolate against one using the default auto value.

isolation-negative-z.css
.card {

  position: relative;

  isolation: isolate;

  background: #fff;

}



.card::before {

  content: "";

  position: absolute;

  z-index: -1;

  inset: 0;

  background: linear-gradient(135deg, #fb7185, #fbbf24);

}
Try It Yourself

How It Works

With isolation: isolate, the gradient pseudo-element stays behind the card background inside the same stacking context.

Example 2 — mix-blend-mode Containment

Isolate a badge so a blended icon does not affect the entire page background.

isolation-blend.css
.badge {

  position: relative;

  isolation: isolate;

  background: #fff;

}



.badge-icon {

  mix-blend-mode: multiply;

}
Try It Yourself

How It Works

Isolation creates a local blending group, so the icon blends with the badge rather than the striped page background.

📈 Default & Component Patterns

Compare auto behavior and use isolation on reusable UI wrappers.

Example 3 — isolation: auto

With the default value, stacking still follows normal rules and other properties may create a context when needed.

isolation-auto.css
.layer-front {

  position: absolute;

  isolation: auto;

  z-index: 1;

}
Try It Yourself

How It Works

auto does not force isolation by itself. The front layer still stacks above the back layer because of its z-index.

Example 4 — Component Wrapper

Wrap a profile card with isolation: isolate so decorative glow layers stay grouped with the component.

isolation-component.css
.widget {

  position: relative;

  isolation: isolate;

  background: #fff;

}



.widget-glow {

  position: absolute;

  z-index: -1;

  inset: -6px;

  background: linear-gradient(135deg, #a78bfa, #38bdf8);

}
Try It Yourself

How It Works

The glow sits behind the card content but remains part of the same isolated component layer group.

♿ Accessibility

  • Isolation does not replace contrast checks — layered backgrounds must still meet readability standards.
  • Avoid hiding focus outlines — negative z-index decorations should not cover focusable controls.
  • Test keyboard navigation — stacking changes should not trap or obscure interactive elements.
  • Do not rely on layering alone — screen readers follow DOM order, not visual stacking.
  • Keep decorative layers non-interactive — use aria-hidden="true" on purely visual glow elements.

🧠 How isolation Works

1

You set isolation on a wrapper

Apply isolation: isolate to the component that should own its own layer group.

CSS rule
2

A new stacking context is created

The browser groups the element and its descendants into one isolated stacking unit.

Stacking
3

Child layers compete inside the group

Negative z-index, blends, and overlays stay contained within the component.

Children
=

Predictable component layering

Your UI stacks reliably without unexpected bleed into the page behind it.

🖥 Browser Compatibility

The isolation property is supported in modern browsers including Chrome 41+, Firefox 36+, Safari 8+, and Edge 79+.

Baseline · Modern browsers

Stacking control in today’s browsers

All major browsers support isolation for explicit stacking context creation.

97% Modern browser support
Google Chrome 41+ · Desktop & Mobile
Full support
Mozilla Firefox 36+ · Desktop & Mobile
Full support
Apple Safari 8+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 28+ · Modern versions
Full support
isolation property 97% supported

Bottom line: Safe to use in modern projects. For very old browsers, test layered UI that depends on isolation.

🎉 Conclusion

The isolation property is a valuable tool for managing stacking contexts and keeping component layers predictable. It helps you avoid unexpected overlaps when using negative z-index, decorative pseudo-elements, or blend modes.

For beginners, start with isolation: isolate on component wrappers that use internal background layers, then explore how it changes blending behavior in more advanced layouts.

💡 Best Practices

✅ Do

  • Use on component wrappers with internal decorative layers
  • Pair with position: relative when using absolute children
  • Contain mix-blend-mode effects inside UI components
  • Test layered cards, badges, and modals in real browsers
  • Prefer isolation over hacky z-index values when grouping layers

❌ Don’t

  • Apply isolate everywhere without a layering need
  • Assume isolation fixes all z-index bugs automatically
  • Hide important content behind negative z-index layers
  • Forget that DOM order still matters for accessibility
  • Replace thoughtful structure with excessive stacking tricks

Key Takeaways

Knowledge Unlocked

Five things to remember about isolation

Use these points when managing component layers and stacking contexts.

5
Core concepts
auto 02

Default auto

Browser pick.

Default
iso 03

isolate

Force context.

Syntax
z:-1 04

Negative z

Contain layers.

Pattern
blend 05

Blend modes

Local effects.

Use case

❓ Frequently Asked Questions

isolation controls whether an element creates a new stacking context. The isolate value forces a new stacking context so child layers stay grouped with the element.
The default is auto, which lets the browser create a stacking context only when other properties such as z-index, opacity, or transform require it.
auto follows normal stacking rules, while isolate always creates a new stacking context even if no other property would trigger one.
No. isolation is not inherited.
Use it when you need predictable layering inside a component, especially with negative z-index children or mix-blend-mode effects.

Practice in the Live Editor

Open the HTML editor, add isolation: isolate to a component, and compare layered behavior with and without it.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful