CSS soft box-shadow: how it works
box-shadow draws a shadow around the element's box. A value has up to five parts: horizontal offset, vertical offset, blur radius, spread radius and color (and an optional inset keyword). What makes a shadow soft is a large blur with a low-opacity color and a small vertical offset, so that the shadow looks like ambient light. The generator opens on the "soft" preset and lets you stack several layers.
A real result
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);Tailwind:
shadow-[0_4px_12px_rgba(0,_0,_0,_0.15)]Read it as: no horizontal offset, 4 px down, 12 px of blur, black at 15% opacity.
Why layered shadows look more natural
A real shadow is darker and sharper next to the object and fades out as it gets away. One blurred layer cannot do both; several layers, each double the offset and blur of the previous one, can. The "layered" preset has 5 of them:
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12),
0 2px 2px rgba(0, 0, 0, 0.12),
0 4px 4px rgba(0, 0, 0, 0.12),
0 8px 8px rgba(0, 0, 0, 0.12),
0 16px 16px rgba(0, 0, 0, 0.12);The six presets
| Preset | box-shadow | Layers | Good for |
|---|---|---|---|
| soft | 0 4px 12px rgba(0, 0, 0, 0.15); | 1 | cards and dropdowns at rest |
| layered | 0 1px 1px rgba(0, 0, 0, 0.12), 0 2px 2px rgba(0, 0, 0, 0.12), 0 4px 4px rgba(0, 0, 0, 0.12), 0 8px 8px rgba(0, 0, 0, 0.12), 0 16px 16px rgba(0, 0, 0, 0.12); | 5 | large panels: a natural fall-off |
| hard | 6px 6px 0 #141413; | 1 | retro, neo-brutalist buttons |
| inner | inset 0 2px 8px rgba(0, 0, 0, 0.35); | 1 | inputs and pressed buttons |
| glow | 0 0 24px 4px rgba(255, 178, 36, 0.6); | 1 | highlights and focus rings |
| lifted | 0 18px 30px -12px rgba(0, 0, 0, 0.45); | 1 | a card hovering above the page |
Common mistakes
- A solid black shadow: use rgba or the opacity field. Real shadows are never fully black, and opaque ones look heavy and dirty.
- Shadows in dark mode: a black shadow barely shows on a dark background. Lift cards with a lighter surface color or a faint border instead.
- Animating box-shadow on hover for many elements: each frame repaints. Put the shadow on a pseudo-element and animate its opacity instead.
- Expecting the shadow to follow rounded or clipped shapes: it follows border-radius but not clip-path; use filter: drop-shadow() for the latter.
How to use the generator
- The soft shadow is loaded; edit the offsets, blur, spread, color and opacity of each layer.
- Add layers, or pick another preset; the preview shows light and dark backgrounds.
- Copy the CSS or the Tailwind class.
Frequently asked questions
How do I make a soft shadow in CSS?
Use a large blur, a low opacity and a small vertical offset: box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15). For more realism stack layers, as in the "layered" preset.
What is the spread radius?
A positive value grows the shadow in every direction before the blur; a negative one shrinks it, which keeps a "lifted" shadow under the box and away from its sides.
Can I put several shadows on one element?
Yes, separated by commas; the first is on top. The generator writes one layer per line.