Home Text Tools Math & Numbers Developer Tools Date & Time Image Tools Blog
CSS Box Shadow Generator

Soft, Realistic CSS Box Shadows for Cards and Pricing Tables

How to tune offset, blur, spread and opacity to create natural card shadows, with layered shadow tips and common mistakes to avoid.

A flat card on a flat page looks cheap, but a heavy dark shadow looks dated. The realistic middle ground is a soft shadow with low opacity and a generous blur. Here is how to dial it in for product cards, pricing tables and dashboard panels.

CSS Box Shadow Generator FREE online toolRuns in your browser. No sign-up, nothing to install. Open the tool

The five values in box-shadow

The syntax is box-shadow: x-offset y-offset blur spread color. The x and y offsets move the shadow, blur softens its edge, spread grows or shrinks it, and the color sets tint and opacity. Add inset to draw the shadow inside the element.

Light usually comes from above, so use a small or zero x offset and a positive y offset. A shadow that falls straight down feels natural.

A starting recipe for cards

  1. Open the CSS Box Shadow Generator and set x to 0 and y to 4px.
  2. Raise blur to around 12px to 20px so edges disappear.
  3. Keep spread at 0 or slightly negative, such as -2px, which stops the shadow poking out at the sides.
  4. Use black or a dark blue-gray at 8 to 15 percent opacity, written as rgba(0, 0, 0, 0.1).
  5. Copy the CSS and paste it into your card rule, then compare against your actual background.

Layer shadows for realism

Real objects cast a tight dark shadow near the contact edge and a wider soft one further away. You can mimic that by listing two shadows separated by a comma, for example: 0 1px 2px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.08). The result looks far more natural than one big blur.

Use elevation consistently

Decide on three or four levels and stick to them. A resting card might use a y offset of 2px, a hovered card 8px, and a modal 24px. Larger offsets and blurs suggest the element is closer to the viewer. Add a transition on box-shadow, around 150ms to 200ms, so hover changes feel smooth.

Mistakes to avoid

  • Pure black shadows at high opacity, which look harsh on white backgrounds.
  • Using shadows on dark themes without adjusting; they barely show, so try a subtle border or lighter surface instead.
  • Big shadows on every element, which flattens the hierarchy.
  • Forgetting that shadows do not affect layout, so neighbors may overlap them.
  • Animating blur on long lists, which can hurt scrolling performance on weaker devices.

Matching shadows to your design

Tint your shadows toward the page background hue rather than pure black. On a pale blue page, a shadow of rgba(30, 50, 90, 0.12) looks far more refined than gray. For brand-colored buttons, a soft shadow in the same hue as the button gives a subtle glow that feels deliberate.

Check your result on a real device. Shadows that look perfect on a bright monitor may vanish on a phone in daylight, and shadows that look soft on a laptop can seem muddy on a low-contrast panel. Adjust opacity by a few percent, not wildly, and keep the same values across components so the interface feels consistent.

Pricing tables and dashboards

Highlight the recommended pricing plan with a slightly deeper shadow or a colored one tinted toward your brand hue. On dashboards, keep panel shadows very light, since many cards sit close together, and rely on spacing for separation.

Try the free CSS Box Shadow Generator
Runs in your browser. No sign-up, nothing to install.

Comments (0)

No comments yet. Be the first to share a thought.