On this page
  1. z-index
  2. Syntax & Overview
  3. Notes & Best Practices
  4. Example

z-index

Prev: `inset` | Up: positioning | Next: `isolation`
Rel: positioning, Positioning & Stacking Guide
Ref: MDN Web Docs — z-index
Tags: #public #web #css #properties #positioning #tier/core


Syntax & Overview

z-index: 10;

Sets paint order along the z-axis within the current stacking context.

Notes & Best Practices

Example

:root { --z-sticky: 10; --z-dropdown: 20; --z-modal: 30; }
.dropdown { position: absolute; z-index: var(--z-dropdown); }

Linked from

Related notes