Hacker News new | ask | show | jobs
by louhike 1220 days ago
You still have the issue of the z-index being relative to its parent, and not absolute. So depending on which element it is set, its effect would not be the same. It’s still a good practice to use constants, but I still often had difficulties to place elements relative to each others on the z-index.
1 comments

Just use position: relative to start a new stacking context as appropriate.
You can use isolation: isolate to explicitly create a new stacking context now. It makes the code a bit clearer because position: relative is used for lots of different things.
I know, but it’s still hard to use on a big website where you have to manage a lot of stacking contexts.