GUIDE深度 · Deep dive

Layered Shadows

Real lighting often has a near, tighter shadow and a far, softer one. Two comma-separated box-shadows look more natural; in dark mode lower opacity or use borders.

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

Combining

Near: 0 1px 2px rgba(0,0,0,.2).

Far: 0 8px 24px rgba(0,0,0,.12).

Order: near first, far second.

Dark mode

Shadows are less visible on dark backgrounds; use borders or luminance contrast.

Lower opacity to avoid muddiness.

FAQ

Do layers hurt performance?

Static is usually fine; test animated or large-blur shadows.

Can it work with focus?

Yes, but focus rings need enough contrast; do not rely on shadow alone.

Sources

Related calculators

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

More guides

box-shadow SyntaxRead guide