Menu

Why your z-index doesn't work: my debugger now points to the exact line
πŸ“°

Why your z-index doesn't work: my debugger now points to the exact line

DEV Community: cssΒ·AntonioΒ·about 2 hours ago
#rUfmAybN
#devtocss#devto#dev#css#article
Reading 0:00
15s threshold

The same evening I shipped this, Chrome opened "New in DevTools" and proudly announced DevTools for agents: AI that reads your CSS rules. Thanks Google, I'll take it as a sign I'm on the right track. Their version is for AI agents. Mine is for a 53-year-old guy pressing F6πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚.

We've all done it. A popup stays behind the header, so you write z-index: 999 . Then 9999 . Then 99999 . Nothing changes.

The problem is almost never the element you're fixing. It's one of its ancestors .

The invisible box

When an element has a transform , an opacity below 1, a filter , or a position with a z-index , it creates a stacking context . Think of it as a closed box: its children can only stack inside the box. A child with z-index: 99999 is still only as high as the box itself.

DevTools won't tell you which ancestor is the box.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.