Class reference

Z-Index - 图1

Usage

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

Z-Index - 图2

Responsive

To control the z-index of an element at a specific breakpoint, add a {screen}: prefix to any existing z-index utility. For example, use md:z-50 to apply the z-50 utility at only medium screen sizes and above.

For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.

Z-Index - 图3

all

Z-Index - 图4

sm

Z-Index - 图5

md

Z-Index - 图6

lg

Z-Index - 图7

xl

Z-Index - 图8

Customizing

Z-Index Scale

By default Tailwind provides six numeric z-index utilities and an auto utility. You change, add, or remove these by editing the zIndex section of your Tailwind config.

Z-Index - 图9

Responsive and State Variants

By default, only responsive variants are generated for z-index utilities.

You can control which variants are generated for the z-index utilities by modifying the zIndex property in the modules section of your Tailwind config file.

For example, this config will also generate hover and focus variants:

Z-Index - 图10

Disabling

If you don’t plan to use the z-index utilities in your project, you can disable them entirely by setting the zIndex property to false in the modules section of your config file:

Z-Index - 图11