Useful blog

Rules for element stacking order in CSS

The z-index attribute generates a stacked context

A set of elements with a common parent element that move forward or backward together form a stacked context. Each stacked context has a single root element, and when a new stacked context is formed on the element, all child elements in the stacked context are limited to a fixed area in the stacking order. A stacked context forms a whole, and its internal elements have relatively different stacking orders, but when compared to other stacked contexts, they can only be moved up or down as a whole.

The rules for constructing stacked contexts

The stacking order of sub elements within the same stacking context

From bottom to top (root<- index<index aotu<+index<position):

Different stacking contexts

Exit mobile version