back

Z-Index

Z-Index is used to specify the vertical stacking order of elements.
Basically, when two or more elements overlap, Z-Index decides the order.
A higher number means that the element is higher up the stack, with the highest number on top of all the others.
In order for Z-Index to work, the element needs to be positioned (relative, absolute, or fixed).
The options are:
(1) Auto, the default value, it means that stack number is the same as its parents.
(2) Number, allows you to set the stack number, the higher the number, the closer to the front it is. You can also set a negative number.
(3) Inherit, the value is inherited from its parent element.

Example