Guidance:
1. Do not use position
In this case, each layer follows the HTML positioning rules. The left, right, top, and bottom positioning information is invalid, and the Z-index will not work because there is no Cascade.
2. Use absolute
If the Z-index attribute of two absolute positioning objects has the same value, it will be stacked according to the order they are declared in the HTML document.
2.1 Z-index not used
In this case, it is layered based on the order they are declared in the HTML document, because the default value of Z-index is 0 if not set.
001
002
003
001: located at the bottom layer
002: In the middle layer
003: Highest Level
2.2 Use Z-Index
Z-index is an integer without unit and can be negative. It is arranged according to the value size. The larger the value, the more it is in the outer layer.
001
002
003
001: In the middle layer
002: located at the highest level
003: located at the bottom layer
2.3 parent and child elements
For parent and child elements, the child element belongs to the parent element level, and the child element is above the parent layer.
001
002
003
001: In the middle layer
002: located at the highest level
003: located at the bottom layer
3. Hybrid use of absolute
For elements that do not set the position: absolute attribute, no matter how many Z-index values are set, they are all 0, but below the Z-index: 0 element in position: absolute
001
002
003
001: located at the highest level
002: In the middle layer
003: located at the bottom layer