TToolbox
◳

CSS Shadow Generator

Build box-shadow visually

About this tool

The CSS `box-shadow` property defines the elevation hierarchy and tactile depth of modern web user interfaces—powering card elevations, modal backdrops, and interactive button hover states. Naive single-layer shadows appear harsh and unrefined with artificial dark borders; professional UI engineering layers multiple soft, semi-transparent shadows mimicking natural environmental light diffusion. This tool provides interactive manipulation of X/Y offsets, blur radiuses, spread expansions, inset modes, and layered CSS elevation exports.

How to Use This Tool (Step-by-Step)

1

Adjust Spatial Offsets

Drag sliders to modulate horizontal X-offset and vertical Y-offset to position simulated ambient light angles.

2

Tune Blur & Spread Radiuses

Fine-tune Blur Radius for soft penumbra falloff and Spread Radius to expand or choke shadow contours, or toggle Inset mode.

3

Inspect Realistic Elevation & Copy

The interactive card renders the physical depth instantly. Copy the production-ready `box-shadow` CSS rule with a single click.

Layered Smooth Shadow Stacking

Enables layered multi-shadow compositions, replicating the signature airy, natural elevation aesthetics of Stripe and Apple UI.

Seamless Drop & Inset Shadow Modes

Toggles between traditional drop shadows and inset debossed shadows to design realistic pressed inputs and embedded wells.

100% Client-Side Air-Gapped

Shadow parameters render exclusively within local browser memory. Unreleased design token specifications remain 100% secure.

Shadow Elevation Principles & Performance Tips

  • •Maintain a single global light source: Shadows across all cards must cast in the same direction (typically downwards) to maintain realistic spatial hierarchy.
  • •Cap blur radiuses on scrollable lists: Excessive blur radiuses (>50px) trigger heavy GPU rasterization overhead on mobile browsers.
  • •Shadows in Dark Mode: Drop shadows are invisible against pitch-black backgrounds. Surface elevation in dark themes relies on lighter surface fills and subtle 1px border outlines.

Code & Transformation Examples

Single-Layer vs Multi-Layer Shadow Benchmark

Harsh Single-Layer Shadow
/* 单层生硬阴影 (黑圈明显,缺乏高级感) */
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
Layered Elevation Shadow
/* 双层微光阴影 (一层近景硬轮廓 + 一层远景大面积柔光) */
box-shadow: 
  0 4px 6px -1px rgba(0, 0, 0, 0.1),
  0 20px 25px -5px rgba(0, 0, 0, 0.08);

* Using negative spread radiuses (`-5px`) contracts outer shadows, eliminating dirty boundary halos.

Tailwind CSS Elevation Classes Cheat Sheet

Utility Classes
• shadow-sm : 微弱阴影,适合普通表单输入框与细小标签
• shadow-md : 中度阴影,适合静态信息卡片与下拉菜单
• shadow-lg : 悬浮阴影,适合鼠标 Hover 悬停响应与模态弹窗
• shadow-2xl: 极深浮空,适合全局全局重要公告 Modal 对话框
Color Tinting
不要只用纯黑色阴影!在带颜色的卡片(如蓝色按钮)下方,使用主色的深色透明版(如 rgba(59, 130, 246, 0.35))作为阴影,会产生极其高级的发光宝石质感!

* Tinting shadows with brand primary hues creates glowing, vibrant UI depth.

Frequently Asked Questions

Q: Why does negative spread radius make shadows look premium?

A: Negative spread contracts shadow footprints so blur doesn't bleed out laterally, constraining shadows exclusively underneath the card.

Q: What is the difference between `box-shadow` and `filter: drop-shadow()`?

A: `box-shadow` projects rectangular shadows around the CSS box. `filter: drop-shadow()` respects alpha channels, wrapping tightly around PNG and SVG contours.

Q: What are common UI use cases for `inset` shadows?

A: Common inset uses: Form inputs showing inner depth, toggle switch background tracks, progress bar wells, and tactile pressed-button states.

Related Tools

All processing happens locally in your browser. Your data is never uploaded to a server.
/