~/css/box-shadow-generator
CSS Box Shadow Generator
Tune a CSS box-shadow with sliders and see it on a card straight away: horizontal and vertical offset, blur, spread, colour, opacity and inset. Switch the preview between a light and a dark page, then copy the rule.
Using the CSS Box Shadow Generator
What each value does
The two offsets move the shadow right and down (negative values move it left and up). Blur softens the edge; a larger blur makes the shadow look further from the surface. Spread grows or shrinks the shadow before it is blurred. Inset puts the shadow inside the element, which makes it look pressed in.
Shadows that look natural
Real shadows are soft and fall downward, because light usually comes from above. Keep the vertical offset larger than the horizontal one, use a low opacity, and add a negative spread on large blurs so the shadow does not spill out on every side. Tinting the shadow with your background colour instead of pure black looks less dirty.
Two layers beat one
The optional second layer adds a tight, faint shadow close to the element underneath the wide soft one. Together they read as an object resting on the page, which a single blurred shadow rarely achieves.
Shadows on dark backgrounds
A black shadow on a near-black page is invisible. On dark designs, show depth with a lighter surface colour or a thin light border instead, and use the shadow only to separate floating elements such as menus and dialogs.
Frequently asked questions
Can I layer more shadows?
Yes, box-shadow accepts a comma-separated list. Generate each layer here and join them with commas.
Does box-shadow slow pages down?
A static shadow costs almost nothing. Animating a large blurred shadow can be expensive; animate the opacity of a pseudo-element that carries the shadow instead.
What is the difference from drop-shadow?
box-shadow follows the element's box. The filter: drop-shadow() function follows the visible shape, including transparent PNG and SVG edges, and is available in the CSS filter generator.