Why doesn't z-index work on my element?
Z-index only works on positioned elements (position relative, absolute, fixed, or sticky). If your element has position: static (default), z-index is ignored. See render_steps 1-3 where position: relative enables z-index to work.
💡 Always set position other than static to use z-index.
Why is my element behind another even though it has a higher z-index?
Z-index only compares elements within the same stacking context. If your element is inside a stacking context with lower priority, it can appear behind elements with lower z-index but higher stacking context. This layering depends on stacking context creation (position, opacity, transform).
💡 Check if stacking contexts differ; z-index compares only inside the same context.
Why does opacity less than 1 affect layering?
When opacity is less than 1, the element creates a new stacking context. This can change layering order unexpectedly because the element and its children are grouped together in that context.
💡 Opacity < 1 creates a new stacking context, affecting layering.