The box-shadow property adds one or more shadows around an element’s frame. Each shadow uses X/Y offsets, optional blur and spread, a color, and an optional inset keyword.
The initial value is none. Shadows follow border-radius, do not change layout size, and can be stacked with commas. For text, use text-shadow. For a non-standard mirror effect, see box-reflect.
Standard-track.
Not deprecated and not experimental. Baseline widely available across modern browsers (IE 9+).
Add inset. The shadow paints inside the padding box.
Small Y offset.0 2px pushes the shade slightly downward.
Blur softens the well.8px keeps the edge smooth.
Sits under content. Text and children stay readable above the inner shadow.
Edge Cases & Pitfalls
Shadows are paint only. Watch clipping, stacking, and contrast.
layout
Does not change box size
Shadows sit outside the box model. A parent with overflow: hidden can clip them even though width/height are unchanged.
radius
Follows border-radius
If the element has border-radius, the shadow corners match that curve.
stack
First shadow is on top
In a comma list, earlier shadows paint above later ones. Order matters for layered looks.
vs outline
Not a focus ring substitute alone
For keyboard focus, prefer a clear outline (or a deliberate focus style). Shadows alone can be easy to miss.
perf
Heavy stacks cost paint
Many large blurred shadows on busy pages can slow scrolling. Keep card shadows light when you can.
Compatibility
Browser Support
box-shadow is a browser style property. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
box-shadow
Chrome 10+, Firefox 4+, Safari 5.1+, Edge 12+, Opera 10.5+, Internet Explorer 9+. Safe for production without a prefix.
98%global support
Google Chrome10+
Full support
Mozilla Firefox4+
Full support
Apple Safari5.1+
Full support
Microsoft Edge12+
Full support
Opera10.5+
Full support
Samsung Internet1+
Full support
Internet Explorer9+
Full support
box-shadowUniversally supported in modern browsers
Bottom line: Unprefixed box-shadow is standard and widely supported. No vendor prefix is needed in current browsers.
Remember
Key Takeaways
Role: paint outer or inset shadows around a box.
Order: X, Y, blur, spread, color — plus optional inset.
Layers: comma-separate shadows; the first sits on top.
Layout: shadows do not add to width or height.
One line:box-shadow adds depth with offset, blur, spread, and color — outside or inset.
Frequently Asked Questions
It paints one or more shadows around an element's box using offset, blur, spread, color, and an optional inset keyword.
The initial value is none, so no shadow is drawn until you set one.
Blur softens the shadow edge. Spread grows or shrinks the shadow before blur — positive expands, negative contracts.
inset draws the shadow inside the element (a pressed-in look) instead of outside as a drop shadow.
Yes. Separate shadows with commas. The first shadow in the list is painted on top.
It is Baseline widely available: Chrome 10+, Firefox 4+, Safari 5.1+, Edge 12+, Opera 10.5+, Internet Explorer 9+. It is a browser style property, not a Node.js feature.