> ## Documentation Index
> Fetch the complete documentation index at: https://skelementorcss.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Z-Index

> Control stacking order with the bundled z-index scale.

export const ZIndexCirclesDemo = () => {
  const items = [{
    z: 10,
    label: "z-10",
    color: "#ec4899"
  }, {
    z: 20,
    label: "z-20",
    color: "#a855f7"
  }, {
    z: 30,
    label: "z-30",
    color: "#6366f1"
  }, {
    z: 40,
    label: "z-40",
    color: "#0740f9"
  }, {
    z: 50,
    label: "z-50",
    color: "#06b6d4"
  }];
  return <div className="not-prose my-6">
      <div className="tw-demo">
        <span className="tw-label">z-index scale</span>
        <div className="tw-demo-card" style={{
    display: "flex",
    justifyContent: "center",
    paddingLeft: "2rem"
  }}>
          {items.map((item, i) => <div key={item.label} style={{
    zIndex: item.z,
    width: "5rem",
    height: "5rem",
    marginLeft: i === 0 ? "0" : "-1.5rem",
    background: item.color,
    borderRadius: "9999px",
    border: "3px solid var(--demo-ring)",
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    boxShadow: "0 4px 8px rgba(0,0,0,0.3)"
  }}>
              <span style={{
    fontSize: "0.65rem",
    fontWeight: 700,
    color: "#ffffff",
    fontFamily: "monospace"
  }}>{item.label}</span>
            </div>)}
        </div>
      </div>
    </div>;
};

export const StackedCardsDemo = () => {
  const cards = [{
    z: 0,
    label: "z-0  · Base card",
    color: "#64748b",
    offset: 0
  }, {
    z: 10,
    label: "z-10 · Middle card",
    color: "#6366f1",
    offset: 1
  }, {
    z: 20,
    label: "z-20 · Top card",
    color: "#0ea5e9",
    offset: 2
  }];
  return <div className="not-prose my-6">
      <div className="tw-demo">
        <span className="tw-label">stacked cards</span>
        <div className="tw-demo-card" style={{
    position: "relative",
    height: "12rem"
  }}>
          {cards.map(c => <div key={c.label} style={{
    position: "absolute",
    zIndex: c.z,
    top: `${1 + c.offset * 1.5}rem`,
    left: `${1.5 + c.offset * 2}rem`,
    right: `${5 - c.offset * 2}rem`,
    padding: "1rem 1.25rem",
    background: c.color,
    borderRadius: "0.75rem",
    color: "#ffffff",
    fontSize: "0.8rem",
    fontWeight: 600,
    fontFamily: "monospace",
    boxShadow: "0 8px 20px rgba(0,0,0,0.25)"
  }}>
              {c.label}
            </div>)}
        </div>
      </div>
    </div>;
};

export const OverlayDemo = () => {
  return <div className="not-prose my-6">
      <div className="tw-demo">
        <span className="tw-label">overlay pattern (z-10 backdrop + z-20 content)</span>
        <div className="tw-demo-card" style={{
    position: "relative",
    height: "12rem",
    padding: 0,
    overflow: "hidden",
    background: "linear-gradient(135deg, #38bdf8, #a855f7, #f97316)"
  }}>
          <div style={{
    position: "absolute",
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    zIndex: 10,
    background: "rgba(0,0,0,0.45)"
  }} />
          <div style={{
    position: "absolute",
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    zIndex: 20,
    display: "flex",
    flexDirection: "column",
    alignItems: "center",
    justifyContent: "center",
    gap: "0.5rem"
  }}>
            <span style={{
    fontSize: "1.25rem",
    fontWeight: 700,
    color: "#ffffff"
  }}>Overlay Text</span>
            <span style={{
    fontSize: "0.75rem",
    color: "rgba(255,255,255,0.7)",
    fontFamily: "monospace"
  }}>z-20 above z-10 backdrop</span>
          </div>
        </div>
      </div>
    </div>;
};

## Overview

Use `z-*` utilities to keep stacking order predictable without inventing one-off values.

Z-index utilities control which positioned elements sit above others. Higher values paint in front. The bundle ships **`z-0`** through **`z-100`** in **steps of 10** so teams can reserve bands for base content, chrome, overlays, and top-most UI without one-off numbers.

| Class    | Value | CSS             | Usage                                     |
| -------- | ----- | --------------- | ----------------------------------------- |
| `.z-0`   | 0     | `z-index: 0;`   | Base stacking within a context            |
| `.z-10`  | 10    | `z-index: 10;`  | Low overlays, scrims, local stacking      |
| `.z-20`  | 20    | `z-index: 20;`  | Content above low overlays                |
| `.z-30`  | 30    | `z-index: 30;`  | Mid-stack UI                              |
| `.z-40`  | 40    | `z-index: 40;`  | Elevated panels and popovers              |
| `.z-50`  | 50    | `z-index: 50;`  | Dropdowns, modals, high-priority overlays |
| `.z-60`  | 60    | `z-index: 60;`  | Above standard modal surfaces             |
| `.z-70`  | 70    | `z-index: 70;`  | Reserved for nested layering              |
| `.z-80`  | 80    | `z-index: 80;`  | Strong emphasis layers                    |
| `.z-90`  | 90    | `z-index: 90;`  | Near-top system UI                        |
| `.z-100` | 100   | `z-index: 100;` | Toasts, tooltips, maximum shipped layer   |

## Scale Visualization

Higher z-index values render in front of lower ones. Each circle below overlaps the previous one because of its higher `z-index`.

<ZIndexCirclesDemo />

<Callout icon="puzzle-piece" color="#8f1d7d">
  <div className="sk-elementor-callout-text">
    **Elementor limitation:** Imported **`z-*`** classes only behave reliably when the target element also has **non-**`static` **positioning**—for example **`.relative`**, **`.absolute`**, **`.fixed`**, or **`.sticky`**—on the **same** node you expect to stack. Elementor is set up so **`z-*` must be paired with a position class**; `z-index` alone on `position: static` will not do what you want. That aligns with CSS (`z-index` affects positioned boxes), but the practical rule in Elementor is: **always ship `z-*` together with a position utility.**

    In Elementor v4, **`elementor-element`** wrappers for atomic elements often already include **`position: relative`** from the editor, which can satisfy that requirement for descendants. If **`z-*`** seems ignored, add **`relative`** (or another non-static position from the bundle) on the element that should establish or join the stacking context.
  </div>
</Callout>

## Stacked Cards

A common pattern where cards overlap at increasing z-index values, creating a layered stack effect.

<StackedCardsDemo />

```html theme={null}
<div class="elementor-element relative" style="height: 12rem;">
  <div class="absolute z-0 background-gray rounded-lg padding-4" style="top: 1rem; left: 1.5rem; right: 5rem;">
    Base card
  </div>
  <div class="absolute z-10 background-primary text-white rounded-lg padding-4" style="top: 2.5rem; left: 3.5rem; right: 3rem;">
    Middle card
  </div>
  <div class="absolute z-20 background-secondary text-white rounded-lg padding-4" style="top: 4rem; left: 5.5rem; right: 1rem;">
    Top card
  </div>
</div>
```

## Overlay Pattern

A background image with a semi-transparent backdrop at `z-10` and content above at `z-20`. This is the foundation for hero sections, modals, and lightboxes.

<OverlayDemo />

```html theme={null}
<div class="elementor-element relative overflow-hidden rounded-lg" style="height: 12rem;">
  <img alt="Background" class="width-full height-full object-cover" src="hero.jpg"/>
  <div class="absolute z-10 background-black opacity-50" style="top: 0; right: 0; bottom: 0; left: 0;">
  </div>
  <div class="absolute z-20 flex items-center justify-center" style="top: 0; right: 0; bottom: 0; left: 0;">
    <h2 class="text-white text-2xl font-bold">
      Overlay Text
    </h2>
  </div>
</div>
```

## Best Practices

<Steps>
  <Step title="Stick to the Shipped Scale">
    Use the bundled steps from `z-0` to `z-100` (increments of 10) instead of inventing arbitrary values.
  </Step>

  <Step title="Plan Layers Early">
    Decide which surfaces are base content, overlays, or modal-level UI before assigning classes.
  </Step>

  <Step title="Use Position Utilities Together">
    Z-index only works as intended when the element is also positioned.
  </Step>

  <Step title="Keep Stacking Contexts Simple">
    Deeply nested positioned elements can make layering hard to reason about.
  </Step>
</Steps>

## Related Utilities

<CardGroup cols={2}>
  <Card title="Positioning" icon="arrows-up-down-left-right" href="/layout/positioning">
    Position utilities for z-index to work
  </Card>

  <Card title="Display" icon="display" href="/layout/display">
    Display utilities for layout control
  </Card>
</CardGroup>
