11 ms·
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 lightb
by dfabulich 9y 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-eca67feb079c https://hackernoon.com/my-approach-to-using-z-index-eca67feb...
- mozumder 9y agoCSS Flexbox and CSS Grid allows one to reorder elements to avoid Z-index problems as well.