Module lessons (2/4)
Decoding z-index, Stacking Contexts & isolation: isolate
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-indexand understand whyz-indexdoes nothing onposition: static. - Explain Stacking Contexts: why
z-index: 9999inside one parent can still lose behind a sibling withz-index: 2! - Isolate intentional local
z-indexbadges cleanly inside components usingisolation: isolate(without creatingopacityortransformside 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
- 1Why
z-index: 9999Doesn't Always Win - 2Inspect Stacking Context Traps Live
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.