Last updated: 10 May 2024

Tailwind CSS Box Shadow

The tailwind box-shadow utility class allows you to add shadows to elements, giving them a three-dimensional effect and enhancing their visual appearance.


Tailwind box Shadow

The tailwind box shadow utility class allows you to add shadows to elements, giving them a three-dimensional effect and enhancing their visual appearance. With Tailwind's box-shadow class, you can easily customize and apply different types of shadows to elements.

Applying Tailwind Box Shadow

To apply a tailwind box shadow to an element, you can use the shadow-{value} utility class, where {value} represents the desired shadow style. Here are the available options:

  • shadow-sm: Applies a small shadow.
  • shadow: Applies a medium shadow (default).
  • shadow-md: Applies a medium shadow.
  • shadow-lg: Applies a large shadow.
  • shadow-xl: Applies an extra-large shadow.
  • shadow-2xl: Applies a 2x extra-large shadow.
  • shadow-inner: Applies an inset shadow.
html
<div class="flex">
<div class="shadow-md">Item 1</div>
<div class="shadow-xl">Item 2</div>
<div class="shadow-2xl">Item 3</div>
</div>

Preview

Item 1
Item 2
Item 3

Customizing Tailwind Box Shadow

Tailwind CSS also provides utility classes to customize the color and size of the box shadow. You can use the following utility classes in conjunction with the shadow class:

  • shadow-{color}: Applies a custom color to the shadow. For example, shadow-red-500 applies a red-colored shadow.
  • shadow-{size}: Applies a custom size to the shadow. For example, shadow-offset-2 moves the shadow 2 units from its default position.
html
<div>
<div class="shadow-xl shadow-blue-500">
Item 1
</div>
</div>

Preview

Item 1

Responsive Tailwind Box Shadow

Tailwind CSS allows you to apply box shadow classes responsively at different breakpoints. To use responsive tailwind box shadow classes, you can append the breakpoint prefix to the utility class. For example, md:shadow-lg applies a large shadow starting from the medium breakpoint and above.

html
<div class="shadow-lg md:shadow-xl">
<!-- Content here -->
</div>

In the above example, the shadow applied to the <div> element is large by default (shadow-lg), but starting from the medium breakpoint and above, it changes to an extra-large shadow (md:shadow-xl).

Tailwind Box-shadow Class Table

ClassProperties
shadow-smbox-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
shadow box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
shadow-mdbox-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
shadow-lgbox-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
shadow-xlbox-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
shadow-2xlbox-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25)
shadow-innerbox-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05)
shadow-nonebox-shadow: 0 0 #0000;

Windframe Tailwind blocks

Content

Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs

Start building stunning tailwind UIs! 

Build from scratch or select prebuilt tailwind templates