Shadows and filters are the finishing touches that transform a flat design into a professional, tactile interface. They provide depth, emphasize hierarchy, and allow for advanced image processing directly in the browser.
1The Shadow Stack
Real-world shadows aren't just one gray blob. They are layered.
- →box-shadow: Can take multiple values separated by commas. Professional designers layer a small, dark shadow for sharpness and a large, soft shadow for depth.
- →inset: Flips the shadow inside the element, perfect for buttons or input fields.
- →spread: Increases or decreases the size of the shadow relative to the element.
2Backdrop Magic
Filters apply to the element itself, but backdrop-filter applies to whatever is *behind* it.
- →Glassmorphism: Combine a semi-transparent background with a
blur()backdrop-filter to create the 'frosted glass' look popular in modern OS design. - →drop-shadow() vs box-shadow: Use
drop-shadow()as a filter when you want the shadow to conform to a transparent image's non-rectangular edges.
