Hacker News new | ask | show | jobs
by yoran 3020 days ago
For z-indexes, we're using a slightly an approach that I find a bit clearer:

  $some-element-z-index: 1 + max(
    $other-element-z-index,
    $should-be-below-z-index
  );
This way the relationship between elements that should be below or above is more explicit.

In my head, it works a bit like a spreadsheet. You update the z-index value of an element somewhere below, and all the z-indexes that depend on it update their value too.