so many people use z-index like "9" "99" "999" when that can be 1, 2, 3. (or rather 10, 20, 30 to allow insertion between elements in the future) this isn't an ai thing. I tend to use brackets, going in 10s unless i'm inserting between other elements, < 0 for a "background layer" 10-80 for "midground" and 100+ for "foreground" (that jump of 20 between 80 and 100 is deliberate to better distinguish those brackets. (sliding a few elements in behind a 100 z-index layer at 99, 98.. and so on is less likely to clash with sliding elements in in front of a 80 midground at 81, 82...)
I recently had a colleague complaine about a 150 foreground element in a code review "but what if it goes in front of a 1000 element" and i almost cried.
While itās technically correct, the idea of using 9s to represent index can become complicated if many elements use z-index. Ideally youād want to keep track of all usages and either use a sequential ordering (e.g. 1 through 10) or in increments of 10 to quickly insert a new element at 15 as needed, but that would require a quick fix
I've seen this a lot before AI. And gave up on centralising it in a previous app. It's also not only the index that matters, but also the stacking context
Did you try grouping contexts into layers? Like main content in parent cointainer 1 at z 100, popup articles in container 2 at 200, nav elements in container 3 at 300, toasts and warnings in the overlay container at 400 with toasts calculating off the highest z value from children in the overlay container and +1 on their generation?
The index of the container is evaluated first, then the content. So it's more like container 1 has index 1 und it's children 1-10, container 2 has children 1-10 etc. But of course one might have more nesting. In the end one should think about the hierarchy and good indices within each layer of the hierarchy. But if course it gets tricky. Models and notifications on top and then custom styled select that has to be positioned absolutely and whatnot.
The idea of the comic was to emphasize the poor z-index usage, hence I would only mention that. Do you really think itās wise to ask for help when the answer involves a single line of code? More so with something as relatively trivial as css?
Actually the LLMs the company Iām at generated (among other lines) this z-index recently, using Claude 5. Iām assuming either the other generated work threw it off or it detected the z-index usage across the app and didnāt bother to try harder
The artist really managed to capture the essence of terrible early 00's webcomics made by kids who have their first graphics tablet but have never picked up a pencil. Nostalgic.
I programmed a 2d game, and had a stay in zindex hell.
It was made worse by zindex not being the only depth factor, different objects layered on top of each other with their own internal z index with various things inside. More than a few struggles of wanting a to be above b, b to be above c, and c to be above a.
146
u/Bemteb Oct 05 '26
To be fair, there is lots of code out there from which AI can learn exactly that behavior.
27
u/Saelora Oct 05 '26
so many people use z-index like "9" "99" "999" when that can be 1, 2, 3. (or rather 10, 20, 30 to allow insertion between elements in the future) this isn't an ai thing.
I tend to use brackets, going in 10s unless i'm inserting between other elements, < 0 for a "background layer" 10-80 for "midground" and 100+ for "foreground" (that jump of 20 between 80 and 100 is deliberate to better distinguish those brackets. (sliding a few elements in behind a 100 z-index layer at 99, 98.. and so on is less likely to clash with sliding elements in in front of a 80 midground at 81, 82...)
I recently had a colleague complaine about a 150 foreground element in a code review "but what if it goes in front of a 1000 element" and i almost cried.
17
u/Ethameiz Oct 05 '26
What's wrong or funny here?
31
u/Markronom Oct 05 '26
I've seen this a lot before AI. And gave up on centralising it in a previous app. It's also not only the index that matters, but also the stacking context
2
u/gfcf14 Oct 05 '26
While correct, using such complex numbering implies a bigger problem
1
u/turudd Oct 06 '26
What model are these people using? Like 3.5. I havenāt seen generated code like that in awhile
3
u/Erinaceomorpha Oct 05 '26
The artist really managed to capture the essence of terrible early 00's webcomics made by kids who have their first graphics tablet but have never picked up a pencil. Nostalgic.
1
u/Temporary-Concept-81 Oct 05 '26
I programmed a 2d game, and had a stay in zindex hell.
It was made worse by zindex not being the only depth factor, different objects layered on top of each other with their own internal z index with various things inside. More than a few struggles of wanting a to be above b, b to be above c, and c to be above a.
1
u/em-pe Oct 06 '26
One of us!