FrontendBeginner
Z-index
PronunciationZEE IN-deks
Definition
A CSS property that specifies the stack order of an element along the Z-axis, determining which elements appear in front of or behind others.
Where you hear it
In frontend layout discussions, fixing overlapping elements, or building dropdown menus and modals.
Examples
We increased the
z-indexof the modal to ensure it appears above the navigation bar.The dropdown menu is hidden behind the hero image because its
z-indexis too low.
Common mistake
Expecting z-index to work on elements with a position value of static, even though it only affects positioned elements.