What is CSS box-shadow?
The box-shadow property adds a shadow effect around an HTML element. It creates depth, elevation and layered effects without image files. Widely used for cards, buttons, modals and form elements.
Syntax
box-shadow: [inset] offset-x offset-y blur spread color;
- offset-x/y: Horizontal and vertical position. Negative values shift left/up.
- blur: Blur radius. Higher = softer; 0 = sharp edge.
- spread: Expands or shrinks the shadow. Negative values contract it.
- inset: Applies the shadow to the inner surface of the element.
Design Tips
Realistic shadows typically use two layers: a large, diffuse one for elevation and a small, sharp one at the contact point. Colored shadows matching your brand accent create a modern, distinctive look.
Comments