The z-index is a CSS property that specifies the order of elements when they overlap. It allows you to stack elements on top of each other and control which one appears on top.
Example:
HTML:
Box 1
Box 2
CSS:
.box1 {
position: absolute;
z-index: 1;
}
.box2 {
position: absolute;
z-index: 2;
}
In this example, box 2 will appear on top of box 1 because it has a higher z-index.