CSS: z-index Not Working: Stacking Contexts Explained
Stacking.
z-index only works on positioned elements, and an element can never rise above a stacking context it sits inside. Most failures come from one of those two rules.
Step 1: Check the position

z-index needs position set to relative, absolute, fixed or sticky (or the element to be a flex or grid item).
Step 2: Find the stacking context

Right-click, Inspect and look at the parents. A parent with transform, opacity below 1, filter or its own z-index creates a context.
Step 3: Compare siblings

An element is only compared with others inside the same context. A huge z-index inside a low context still loses.
Step 4: Move the element

Move the overlay to a higher level, for example directly under the body.
Step 5: Remove the culprit

Remove an unnecessary transform or opacity from the parent.
Step 6: Use sensible values

Use small scales such as 10, 100, 1000 rather than 99999.
Step 7: Test

Check desktop and mobile.
Still stuck?
If these steps do not solve it, we fix it for you for a flat $99. Full refund if we do not solve it within 7 days.
Related guides
- WordPress Theme Customizer Preview Blank or Stuck Loading
- WordPress Multilingual Plugins: URLs, Duplicates and SEO Issues
- WordPress Block Editor Fonts and Icons Missing in Editor But Fine on Site
- WordPress Background Images Not Loading on Mobile