Stacking order

noun

say it: “STAK-ing OR-der” /ˈstækɪŋ ˈɔrdər/

The order in which the browser paints overlapping layers: backgrounds first, then normal content, then positioned elements from the lowest z-index to the highest.

What is the stacking order?

The stacking order is the order layers are drawn in a stacking context: backgrounds first, then normal content, then positioned elements by z-index.

.overlay { position: absolute; z-index: 2; }
.content { position: relative; z-index: 1; }   /* drawn under .overlay */

In a sentence

  • “By the stacking order, the positioned badge is painted after the card's text, so it sits on top.”

Level: Master · More CSS terms at this level

Updated