The z-index property specifies the z-order of an element and its sub-elements.
An element with a higher z-index is always in front of an element with a lower z-index.
If two elements have the same z-index, the order of those elements is determined by their source order, which is the order in which they appear in the document code.
Here is a simple example:
<div style="position:absolute; z-index:2;">DIV #2</div>
<div style="position:relative; z-index:1;">DIV #1</div>
In the above example, DIV #2 will be in front of DIV #1 because it has a higher z-index.
If both DIVs had the same z-index (for example, "z-index:1"), then DIV #2 would be behind DIV #1 because it comes after DIV #1 in the document code.