Tailwind CSS Shadow Generator

Create stunning box shadows with our visual editor.
Support multi-layer shadows and 6 popular presets.

阴影层

Preview

JIT 类名

shadow-[0px_4px_6px_-1px_rgba(0,0,0,0.10),0px_2px_4px_-1px_rgba(0,0,0,0.06)]

Tailwind Configuration

module.exports = {
  theme: {
    extend: {
      boxShadow: {
        'custom': '0px 4px 6px -1px rgba(0, 0, 0, 0.10), 0px 2px 4px -1px rgba(0, 0, 0, 0.06)',
      }
    }
  }
}

Usage Instructions

  • JIT 类名:直接在 className 中使用
  • 配置代码:添加到 tailwind.config.js 后使用 shadow-custom
  • 支持多层阴影叠加,最多 5 层
  • Inner Shadow适合输入框等凹陷效果

Shadow preset

How to Use Tailwind CSS Shadows

Box shadows are essential for creating depth and visual hierarchy in modern web design. Tailwind CSS provides a comprehensive shadow system that makes it easy to add professional-looking shadows to your components without writing custom CSS. Understanding how to effectively use shadows can transform flat designs into engaging, three-dimensional interfaces.

Understanding Shadow Utilities

Tailwind provides built-in shadow utilities ranging from shadow-sm to shadow-2xl. These utilities apply pre-configured box-shadow values that work well for most use cases. The shadow scale follows a logical progression: smaller shadows for subtle elevation, medium shadows for cards and panels, and larger shadows for modals and floating elements.

For custom shadows, Tailwind's JIT mode allows you to use arbitrary values with the shadow-[...] syntax. This is perfect when you need precise control over shadow properties like offset, blur radius, spread, and color. You can even combine multiple shadow layers to create complex lighting effects.

Multi-Layer Shadow Techniques

Professional designs often use multiple shadow layers to create realistic depth. A common technique is combining a sharp, close shadow with a softer, larger shadow. The close shadow defines the edge of the element, while the larger shadow creates ambient depth. This mimics how light works in the real world, where objects cast both sharp and diffused shadows.

<!-- Single layer shadow -->
<div class="shadow-lg">

<!-- Multi-layer shadow with JIT -->
<div class="shadow-[0_4px_6px_-1px_rgba(0,0,0,0.1),0_2px_4px_-1px_rgba(0,0,0,0.06)]">

<!-- Neumorphism effect -->
<div class="shadow-[-8px_-8px_16px_rgba(255,255,255,0.8),8px_8px_16px_rgba(0,0,0,0.15)]">

Inner shadows, created with the shadow-inner utility or custom inset values, are perfect for creating recessed elements like input fields and pressed buttons. They give the impression that the element is carved into the surface rather than sitting on top of it. This technique is particularly effective in neumorphic designs and modern UI kits.

When designing with shadows, consider the light source direction and maintain consistency across your interface. Shadows should generally come from the same direction (typically top-left or top-center) to create a cohesive lighting environment. Also, be mindful of performance—excessive shadow blur can impact rendering performance, especially on mobile devices. Use shadows purposefully to guide user attention and establish visual hierarchy.

Quick Reference Guide

Built-in Shadow Utilities

  • shadow-sm - Subtle shadow
  • shadow - Default shadow
  • shadow-md/lg/xl/2xl - Increasing depth
  • shadow-inner - Inset shadow
  • shadow-none - Remove shadow

Shadow Properties

  • X/Y Offset - Shadow position
  • Blur - Softness of shadow edge
  • Spread - Shadow size expansion
  • Color - Shadow tint and opacity

Usage Examples

shadow-[0_35px_60px_-15px_rgba(0,0,0,0.3)]
shadow-[inset_0_2px_4px_rgba(0,0,0,0.06)]

Pro Tips

  • Use multi-layer shadows for realistic depth
  • Maintain consistent light direction
  • Combine with hover states for interactivity
  • Consider dark mode shadow adjustments