filter: drop-shadow()
While box-shadow follows the rectangular border box, filter: drop-shadow() traces the actual visible shape of an element — including transparent areas in PNGs, SVGs, and irregular shapes.
Syntax
filter: drop-shadow(offset-x offset-y blur-radius color). Note: no spread-radius and no inset mode.
When to Use drop-shadow vs box-shadow
| Scenario | Use |
|---|---|
| Rectangular element | box-shadow |
| PNG with transparency | filter: drop-shadow |
| Inline SVG icon | filter: drop-shadow |
| Clipped/shaped element | filter: drop-shadow |