Web Design

CSS Box Shadow Examples You Can Copy, and When to Use Each

Five shadows for cards, menus, dialogs and inputs, with the CSS and the reasoning behind each value.

By Zoqonyx Team · · 1 min read

People collaborating in a sunlit office
In this article

A shadow tells people what sits above what. Soft and small reads as a card; large and wide reads as a dialog. Adjust any of these in the box shadow generator.

Design work on a screen

The four numbers

ValueWhat it changes
Horizontal offsetMoves the shadow left or right
Vertical offsetMoves it up or down; light usually comes from above
BlurSoftens the edge
SpreadGrows or shrinks the shadow

Resting card

box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);

Enough to separate a card from a light background.

Hovered card

box-shadow: 0 16px 32px -4px rgba(0, 0, 0, 0.16);

A bigger vertical offset suggests the card has lifted.

box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.18);

Dialog

box-shadow: 0 25px 50px -10px rgba(0, 0, 0, 0.35);

Pressed or inset field

box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.12);

Habits that keep shadows clean

Use one light direction across the page. Keep two or three levels, not a new shadow for every element. Prefer low opacity over dark grey. In dark themes, a lighter surface often separates layers better than a shadow.

Try border radius, gradients and glassmorphism. Each can export CSS, SCSS, Tailwind or React style objects. For a whole interface, see website development.

Frequently asked questions

Short answers to what people ask us first. Need more? Send us a message.

Do shadows slow a page?

Static shadows are cheap. Animating large blurred shadows can cost more, so animate sparingly.

Can I stack shadows?

Yes. Separate them with commas; a tight shadow plus a soft one looks natural.

Free tools in this article

Written by Zoqonyx Team, the team at Zoqonyx. Last updated December 4, 2026.

Talk to our team

Tell us what you are building. We reply with questions and next steps.

Get a quote

Need help with this?

Tell us what you are working on and we will reply with suggestions and next steps.

  • hello@zoqonyx.com
  • Tell us about your idea and we will reply with questions. We work remotely with clients in the USA, Europe, the Gulf and Asia.

Or email us at hello@zoqonyx.com