Skip to main content

How to Add Shadow in CSS

Three ways to add shadows: box-shadow for elements, text-shadow for typography, and drop-shadow for transparent images.

1

box-shadow

Most common shadow for cards, buttons, and containers.

Element
2

text-shadow

Add depth to text for headers or decorative typography.

Shadow Text
3

filter: drop-shadow()

Follows the shape of transparent images and SVGs.

Element
4

Inset Shadow

Creates an inner shadow for pressed or carved effects.

Element

Shadow Scale Examples

Click any shadow to copy its CSS value.

Frequently Asked Questions

What's the difference between box-shadow and drop-shadow?

box-shadow creates a shadow around the element's bounding box (rectangle). drop-shadow follows the actual shape of the element, including transparent areas. Use drop-shadow for PNG images with transparency or SVG icons.

How do I add multiple shadows?

Separate multiple shadows with commas. For example: box-shadow: 0 2px 4px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.1); This creates layered shadow effects.

What's the inset shadow?

Adding 'inset' keyword creates an inner shadow (inside the element) instead of an outer shadow. Useful for pressed button effects or input fields: box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);