What is z-index?

Description: Used to set the stack hierarchy of elements, with elements with higher levels displayed first.

Note: The Z-index only works on positioned elements

Therefore, if z-index fails, it is most likely not located.

Position attribute

The default value is static, no location, normal document flow;

Relative, relative, relative, relative

Absolute: Absolute position, relative to the first parent element other than static; — Leave the document flow

Fixed: fixed position relative to the browser window. — Leave the document flow