GUIDE深度 · Deep dive

box-shadow Syntax

box-shadow: x y blur spread color. x/y are required, blur/spread optional, inset goes first; multiple layers are comma-separated, earlier ones on top.

更新 2026-10-31 · 公式可核验

Parameters

x: horizontal offset, positive right.

y: vertical offset, positive down.

blur: blur radius, non-negative.

spread: expansion, can be negative.

inset

inset draws the shadow inside the element.

Common for inset inputs and cards.

FAQ

Does a shadow affect layout?

No; it does not change box dimensions.

Can I put it on one side only?

Use offset plus negative spread, or a pseudo-element.

Sources

Related calculators

CSS Box Shadow GeneratorTune X/Y offset, blur, spread, color and inset, preview live and copy the box-shadow.

More guides

Layered ShadowsRead guide