z-index

Sets the stack order of a positioned element. Elements with a higher z-index are always in front of an element with a lower z-index.

Quick example

.modal {
  position: fixed;
  z-index: 9999;
  /* ensures the modal stays on top of everything else */
}

Quick facts

Initial value
auto
Inherited
No
Applies to
positioned elements
Animation type
integer

Values

auto

z-index Browser Support

Widely available Since 2015 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.

Safe to use without fallbacks.

1+
1+
1+
12+
ESC