HTML z-index tip: You might not need a z-index at all
HTML z-index tip: You might not need a z-index at all.
Here's why: Later HTML elements are automatically rendered above earlier elements.
So, a z-index can often be eliminated by moving the markup that you want to render on top...to the bottom of the HTML. 😎
Note: This tip assumes both elements are in the same stacking context.
For more on stacking context, check out @JoshWComeau excellent post: https://www.joshwcomeau.com/css/stacking-contexts/