examples

Understanding z-index and Stacking Contexts

Stacking contexts and the z-index property are closely connected and can be influenced by any number of properties from position to isolation as summarized in the blog post Putting Things on Top of Other Things:

z - index !== "auto" &&
  (position !== "static" || parentElement.style.display === ("flex" || "grid"));

opacity !== 1;
transform !== "none";
mix - blend - mode !== "normal";
filter !== "none";
perspective !== "none";
isolation === "isolate";
position === "fixed";

The post was written in 2018, today we can also include the will-change property and some values of the clip-path property. There may be more (haven’t been able to find a complete list within the standard pages themselves).

Source Code for examples

References:

Standards and MDN

Articles