The boxes of elements can be stacked like pancakes. An element's z-index value determines if it appears in front or back of another element. Z-index values are integers that place elements on specific stack levels relative to their siblings and parent elements.
Elements can have the same z-index value and be placed on the same stack level.
If the z-index property is not used, the stack level of an element is determined by default by the element's position in the object hierarchy. Elements are stacked from bottom to top in the order they appear in the document tree , so an element is placed directly in front of its parent element. The z-index property is useful when two elements occupy the same space and you need to specify which one should be visible. By default, if an element with transparent areas is stacked above another, it allows the element below it to be visible through its transparent areas. The z-index property.