Class reference

Box Shadow - 图1

Outer shadow

Use the .shadow, .shadow-md, or .shadow-lg utilities to apply different sized outer box shadows to an element.

Box Shadow - 图2

Inner shadow

Use the .shadow-inner utility to apply a subtle inset box shadow to an element. This can be useful for things like form controls or wells.

Box Shadow - 图3

Outline shadow

Use the .shadow-outline utility to apply a focus-ring-style shadow to an element. This can be useful when combined with .focus:outline-none to create a better looking focus style that follows an element’s border radius.

Box Shadow - 图4

No shadow

Use .shadow-none to remove an existing box shadow from an element. This is most commonly used to remove a shadow that was applied at a smaller breakpoint.

Box Shadow - 图5

Responsive

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

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

Box Shadow - 图6

all

Box Shadow - 图7

sm

Box Shadow - 图8

md

Box Shadow - 图9

lg

Box Shadow - 图10

xl

Box Shadow - 图11

Customizing

Box Shadows

By default Tailwind provides three drop shadow utilities, one inner shadow utility, and a utility for removing existing shadows. You can change, add, or remove these by editing the shadows section of your Tailwind config.

If a default shadow is provided, it will be used for the non-suffixed .shadow utility. Any other keys will be used as suffixes, for example the key '2' will create a corresponding .shadow-2 utility.

Box Shadow - 图12

Responsive and State Variants

By default, only responsive, hover and focus variants are generated for shadow utilities.

You can control which variants are generated for the shadow utilities by modifying the shadows property in the modules section of your Tailwind config file.

For example, this config will also generate variants:

Box Shadow - 图13

Disabling

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

Box Shadow - 图14