Hacker News new | ask | show | jobs
by dfabulich 3021 days ago
The advice to use CSS variables to handle Z-index confusion is a good first step, but IME that's only the right way to handle global z-indexes like modal lightboxes and menus. For local z-indexes, you should also know how and when to create a new stacking context with position: relative.

This is the go-to article I send to newbies struggling with z-index. https://hackernoon.com/my-approach-to-using-z-index-eca67feb...

1 comments

CSS Flexbox and CSS Grid allows one to reorder elements to avoid Z-index problems as well.