
Sticky and fixed-position elements can overlap or hide other elements unexpectedly. The browser's stacking context can produce surprising behavior.
The z-index management pattern handles common cases. The cases without coherent z-index management produce visible bugs.
Sticky header overlapping modal. The modal opens but the header sits on top of it.
Sticky CTA bar hiding form submit buttons. The CTA sits over the form's bottom.
Multiple sticky elements competing. Both want the top of the viewport.
Mobile menu hidden by sticky header. The menu opens but the header is in front.
Establish a clear z-index hierarchy for the site. Common pattern:
Modal overlays: 9999 or higher. Must appear above everything.
Mobile menu when open: 9000. Above content but below modals.
Sticky header: 100. Above normal content; below menus and modals.
Sticky CTA or banners: 50. Above content but below header.
Normal content: 1 or auto.
The hierarchy prevents arbitrary z-index values that fight each other.
CSS positioning creates stacking contexts. An element with z-index 100 inside a stacking context with z-index 1 won't necessarily appear above an element with z-index 50 outside.
The implications: changing one element's parent's positioning can affect its effective stacking.
The mitigation: use position: fixed for top-level overlays. They escape parent stacking contexts.
Z-index issues are usually visible but the root cause isn't obvious. The diagnosis involves understanding stacking contexts; the fix involves a coherent hierarchy.
For sites with z-index bugs, establishing a hierarchy as a first step prevents recurring issues.
Site
Tools
We do not sell your email. We do not spam.
© 2026 RevealTheme. All rights reserved.