Z-Index

    Utilities for controlling the stack order of an element.

    Control the stack order (or three-dimensional positioning) of an element in Tailwind, regardless of order it has been displayed, using the utilities.

    Using negative values

    1. <div class="-z-50">
    2. </div>

    Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:z-50 to only apply the z-50 utility on hover.

    For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

    Breakpoints and media queries

    You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use to apply the z-50 utility at only medium screen sizes and above.

    1. <div class="z-0 md:z-50">
    2. <!-- ... -->
    3. </div>

    By default, Tailwind provides six numeric z-index utilities and an utility. You can customize these values by editing theme.zIndex or theme.extend.zIndex in your tailwind.config.js file.

    tailwind.config.js

    Learn more about customizing the default theme in the theme customization documentation.

    Arbitrary values

    1. <div class="z-[100]">
    2. </div>

    Learn more about arbitrary value support in the arbitrary values documentation.