What is CSS Box Shadow?

Published on November 10, 2026 • Last updated November 10, 2026

Mathematical Formula Included

Official Definition

The CSS box-shadow property adds drop shadow or inner shadow effects around an HTML element frame to convey visual elevation, depth, and hierarchy.

Detailed Explanation

In-Depth Guide

Key Takeaway

In user interface design, shadows simulate physical light sources to create visual depth and separate surface layers.

The CSS box-shadow property accepts up to six parameters: horizontal offset (X), vertical offset (Y), blur radius, spread radius, color (with alpha opacity), and an optional inset keyword for inner shadows.

Modern design systems frequently combine layered multi-shadow declarations—a tight, darker contact shadow alongside a wide, soft ambient shadow—to produce natural, realistic elevation.

Mathematical Formula

$$box-shadow: [inset] \; x \; y \; blur \; spread \; color;$$

Calculation Examples

Subtle elevated card shadow: box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); Inner inset shadow for pressed buttons or input fields: box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15); High-elevation modal dialog shadow: box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

Frequently Asked Questions

Blur radius softens and diffuses the shadow edge, while spread radius expands or contracts the actual size of the shadow shape before blurring.

The inset keyword casts the shadow inside the element frame instead of outside, creating an etched, recessed, or debossed appearance.

Yes. You can separate multiple shadow declarations with commas. The first shadow listed renders on top, with subsequent shadows layered behind it.

What do you need to work out next?

Search 278+ free tools by name, or pick a category below. Every one runs instantly in your browser — no signup, nothing to install.

More Finance tools
AI ADVISOR & COACH

Ask AI Advisor

Ask AI