You can use the z-index
property to control the display order of elements with positioning other than static
.
The z-index
value specifies the stacking order of elements along the Z-axis (depth), with elements having
higher z-index
values displayed on top.
/* Examples */ .element1 { position: absolute; z-index: 1; /* Element will be below element2 */ } .element2 { position: absolute; z-index: 2; /* Element will be above element1 */ }