Troubleshooting
WordPress Z Index Not Working: Causes and How to Fix It

Short answer
z-index usually fails in WordPress because the element has no position value, a parent creates its own stacking context through a transform or opacity, a parent with overflow hidden clips it, or another rule overrides yours. Inspect the element and its parents to find the cause.
Key takeaways
- z-index needs a position value, except on flex and grid children.
- A parent's stacking context traps children, so raise the parent instead.
- Overflow hidden clips elements and cannot be fixed with z-index.
- Transforms from animations often create unexpected stacking contexts.
- Use a small, planned scale of values rather than huge numbers.
Why is z-index not working in WordPress?
z-index usually fails because the element is not positioned, a parent creates its own stacking context, another rule overrides yours, or a parent with overflow hidden is cutting the element off.
Raising the number to 99999 rarely helps. The browser follows strict rules, and a big number cannot break out of a lower layer.
The good news is that every case can be found with your browser's inspector in a few minutes.
If you want the background first, our explainer on what z-index is in WordPress covers how stacking works. This guide is about fixing it.
How do you find which rule is breaking z-index?
Right-click the element that should be on top, choose Inspect, and check its position, z-index and its parents' styles for transforms, opacity, filters or overflow.
Work up the tree from the element to the body. Note any parent with:
- A z-index of its own.
- A transform, filter or opacity below 1.
- position fixed or sticky.
- overflow hidden or auto.
Chrome's guide to viewing and changing CSS shows how to see computed styles and toggle rules on and off.
Toggle suspect properties off one at a time in the inspector. When the element jumps to the front, you found the cause.
Changes in the inspector are temporary. Once you know which property is at fault, copy the fix into your real stylesheet so it stays after a reload.
Is the element missing a position value?
z-index has no effect on an element with the default position of static, so you need position relative, absolute, fixed or sticky for it to work.
This is the most common beginner mistake. The CSS looks right, but nothing changes.
.my-dropdown {
position: relative;
z-index: 20;
}
Flex and grid children are the exception. They respect z-index even without a position value.
MDN's z-index reference lists exactly which elements z-index applies to.
Is a parent creating a stacking context?
If a parent element forms its own stacking context, its children can only move up and down inside it, so no z-index on the child can lift it above an outside element that sits higher.
Common triggers in WordPress themes and builders include transforms used for animations, opacity below 1, filters, will-change and position fixed or sticky on headers.
MDN's guide to the stacking context lists every property that creates one.
The fix is to apply z-index to the parent, not the child. If the header sits behind a slider, raise the header itself:
.site-header {
position: relative;
z-index: 100;
}
If a transform causes it, remove the entrance animation on that section or move the transform to an inner element.
Is overflow hidden cutting the element off?
When a parent has overflow hidden, anything that extends outside it gets clipped, which looks like a z-index problem but cannot be fixed with z-index.
Drop-down menus inside a header with overflow hidden are the classic example. The menu opens, but you only see the top few pixels.
Change the parent to overflow visible, or move the drop-down outside the clipping container. MDN's page on overflow explains each value.
Page builders often set overflow hidden on sections and columns to contain shapes or animations. Check the section's advanced settings.
Is another rule overriding your z-index?
Your rule may be losing to a more specific selector or an !important rule from the theme or a plugin, so the browser applies a different z-index.
In the inspector, overridden rules appear crossed out. That shows which rule wins.
Make your selector more specific rather than reaching for !important. Add a parent class or an ID that the theme does not use.
If your CSS does not load at all, the problem is caching or file location. See CSS changes not showing in WordPress.
How do you fix z-index in Elementor and other builders?
Most builders have a z-index field in each widget or section's advanced settings, and it only works when the container also has a position or sits in the same stacking context as the element it should cover.
In Elementor, look under the Advanced tab for the z-index field. Set it on the section or container, not only the inner widget.
Motion effects and entrance animations add transforms. Turn them off on the parent to test.
If your header from a theme builder sits behind content, give the header template its own higher z-index. Our guide on fixing the header in Elementor covers related layout issues.
Why is a popup or sticky header behind other content?
Popups and sticky headers need to sit above everything, so give them a high value on the outermost container and make sure no parent traps them in a lower stacking context.
Popups often fail because they are placed inside the page content, which has its own stacking context. Popup plugins usually move the popup to the end of the body to avoid this.
Cookie banners, chat widgets and popups from different plugins often compete for the top layer. Decide which one should win, and set the others lower.
Sticky headers create their own stacking context with position sticky. Set a z-index on the header so content scrolling under it stays behind.
If a popup does not show at all, see WordPress popup not working.
Why is the WordPress admin bar covering my header?
The admin bar uses a very high z-index and only shows to logged-in users, so fixed headers can slide under it while you are logged in but look fine to visitors.
Check the page in a private window before changing anything. If it looks right there, nothing is broken.
If you want a fixed header to clear the bar while logged in, offset it with the admin-bar body class WordPress adds. Our guide on removing the WordPress header bar covers hiding the bar instead.
Where should you add z-index CSS?
Add small fixes in Additional CSS or the Site Editor's custom CSS, and put larger or permanent fixes in a child theme stylesheet.
If you are new to child themes, the theme handbook explains how child themes work and why changes there survive updates.
| Place | Best for | Survives theme updates |
|---|---|---|
| Additional CSS (Customizer) | Small fixes on classic themes | Yes |
| Site Editor custom CSS | Block themes | Yes |
| Page builder z-index field | Builder sections and widgets | Yes |
| Child theme style.css | Larger, organized changes | Yes |
| Parent theme files | Not recommended | No |
The web.dev Learn CSS module on z-index is a good reference to keep open while you work.
How do you avoid z-index problems in future?
Use a small, planned scale of values for headers, drop-downs, popups and overlays instead of random large numbers, and avoid transforms on parent sections that hold menus.
A simple scale might be 10 for drop-downs, 100 for the header, 1000 for popups and 2000 for notices. Write it down.
When you add a new plugin that shows overlays, check how it fits on your scale.
Quick fixes by symptom
Match what you see to the most likely cause.
| Symptom | Likely cause | Fix |
|---|---|---|
| z-index changes nothing | Element is static | Add position relative |
| Menu behind slider | Header in lower stacking context | Raise the header's z-index |
| Menu cut off at edge | Parent has overflow hidden | Set overflow visible |
| Worked until animation added | Transform on parent | Remove or move the animation |
| Only wrong when logged in | Admin bar | Check in private window |
Frequently asked questions
Why does z-index 9999 not work?
A higher number only helps inside the same stacking context. If a parent creates its own context with a lower stacking order, no value on the child can lift it above outside elements. Raise the parent instead.
Does z-index work without position?
Not on normal block elements. They need position relative, absolute, fixed or sticky. Children of flex and grid containers are the exception and respect z-index without a position value.
Why is my drop-down menu hidden behind the slider?
The header that holds the menu sits in a lower stacking context than the slider. Give the header a position and a higher z-index than the slider section.
Should I use !important on z-index?
Try a more specific selector first. Using !important can fix one case but makes later changes harder, especially when themes and plugins also use it.
Why does my header look wrong only when I am logged in?
The admin bar shows only to logged-in users and sits on top of the page. Check the site in a private window to see what visitors see.
Sources
- z-index MDN Web Docs
- Stacking context MDN Web Docs
- overflow MDN Web Docs
- Z-index and stacking contexts web.dev
- View and change CSS Chrome for Developers
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


