Ending the z-index madness and avoiding 9999 z-indexes
Most web developers do this error. They think that all divisions are stacked relative to all other divisions' z-index values and thus you end up seeing z-index up to 99999. This is crazy.
I never need to go above 10 for z-index.
The thing people don't know is that within a z-index-stacked division, the z-index count restarts at 0. This means if you are inside a z-index-5 division stacked on top of other divisions, then everything you put inside it will be based on a base 5 z-index. Then you can restart the count at 0 inside this division.
In the example above, a division with z-index 1 inside a division of z-index 7 will render above another division of z-index 5.
Recent Comments