HTML/CSSAdvanced#css#z-index#stacking-context

What is the z-index property and how does stacking context work?

z-index controls the stacking order of positioned elements along the z-axis (higher values appear on top), but only works on positioned elements (not static). A stacking context is a self-contained layer created by properties like position + z-index, opacity < 1, or transform — z-index values only compete within the same context.

Example
.modal {
  position: fixed;
  z-index: 1000;
}
/* A child z-index: 9999 inside a parent with its own stacking context
   still can't escape above a sibling with a higher z-index context */

Related Questions

1
HTML/CSSAdvanced#css#stacking-context

What creates a new stacking context in CSS?

Open
2
HTML/CSSIntermediate#css#bem

What is BEM methodology?

Open
3
HTML/CSSAdvanced#css#methodology

What are other CSS methodologies besides BEM (OOCSS, SMACSS, ITCSS)?

Open