On z-index

Igor Veyner
Sep 19, 2021

Setting a z-index of an element allows elements to overlap and stack on top of each other. Its a straightforward concept. Simply add the z-index CSS property to an element and assign a number to it. The greater the number the higher the element will be placed. Make sure to set the position value to anything other than static as well.

By default elements have a z-index of auto. You can also use negative values and position behind the auto placed elements.

Just remember that there are other elements on the DOM that may have a z-index or you might end up stacking below them!

--

--