# Stacking: z-index and What Sits on Top

When boxes overlap, the browser stacks them like papers on a desk, and z-index, positioning and stacking contexts decide which one ends up on top, including why z-index 9999 sometimes still loses.

![Cheat sheet: Stacking: z-index and What Sits on Top](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/10/38f342e3ee7a4307b60a79940723a566.webp)

- Category: CSS
- Level: Journeyman
- Tags: CSS, Stacking context, Stacking order, Z-index
- Updated: November 1, 2026

Source: https://www.ask-codey.com/cheat-sheets/css-z-index-and-stacking-cheat-sheet
