2026-07-03
What CSS Do I Need for a Soft, Modern Box Shadow?.
Understand blur, spread, offset and opacity so you can create a subtle box shadow instead of a heavy outline.
A soft modern shadow should suggest separation, not announce itself. The usual recipe is a modest vertical offset, a generous blur, little or no spread, and a low-opacity dark color.
A typical starting point looks like this:
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
The first two values set horizontal and vertical offset. The blur controls how soft the edge becomes. Spread makes the shadow larger or smaller before it blurs; it is often best kept near zero for cards and panels.
Avoid the common mistakes
A hard black shadow can make a clean interface look dated. Very large blur values can make cards appear to float too far above the page. Using the same strong shadow everywhere also removes hierarchy: a modal deserves more elevation than an ordinary card.
Use the Shadow Generator to adjust the values visually and copy the CSS when it looks right. Try a softer shadow for default cards and a slightly stronger one for hover or active states.
Always check the result against the actual page background. A shadow that works on white may vanish on a pale gray surface, while a shadow that looks subtle on a large desktop can feel excessive on a phone.
<div class=“author-bio”> <strong>About the author:</strong> Richard Shaw, 30+ yrs software eng. 20 yrs automotive software, globally used retention solutions. Prolific SaaS dev, runs Rezero Software with his family. Contact: rich@rezero.net | rezero.net | @RichShawX </div>