Skip to main content
Module 9 · Lesson 2 of 434/60 in the course~20 min
Module lessons (2/4)

Decoding z-index, Stacking Contexts & isolation: isolate

Lesson preview5 hands-on exercises readyModern HTML & CSS · Positioning, Stacking Context & Container Queries

Spot why transform/opacity trap z-index: 9999 elements and isolate layers safely with isolation: isolate.

What you'll learn in this lesson

  • Predict 3D paint layering cleanly using z-index and understand why z-index does nothing on position: static.
  • Explain Stacking Contexts: why z-index: 9999 inside one parent can still lose behind a sibling with z-index: 2!
  • Isolate intentional local z-index badges cleanly inside components using isolation: isolate (without creating opacity or transform side effects).

Overview

Many developers assume CSS z-index operates like one global vertical staircase from 1 to 999999. In reality, z-index only competes against siblings inside the same Stacking Context!

Think of a Stacking Context like a sealed folder: if Parent Folder A has z-index: 1 and Parent Folder B has z-index: 2, _every layer inside Folder A stays behind Folder B_—even if a tooltip inside A screams z-index: 999999!

Sections covered in this lesson

  1. 1Why z-index: 9999 Doesn't Always Win
  2. 2Inspect Stacking Context Traps Live
Pro Lesson · Positioning, Stacking Context & Container Queries

Unlock "Decoding z-index, Stacking Contexts & isolation: isolate" and the full Modern HTML & CSS curriculum

Spot why transform/opacity trap z-index: 9999 elements and isolate layers safely with isolation: isolate.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Modern HTML & CSS plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.