CSS Gradient Generator
Build linear, radial and conic gradients and copy the CSS.
Design & SEO
Stack multiple shadows on a live card and copy the exact CSS.
The syntax is box-shadow: [inset] x y blur spread color, and each parameter does something visually distinct.
| Value | Effect | Typical range |
|---|---|---|
| x offset | Horizontal displacement; positive moves right | 0 to 4px |
| y offset | Vertical displacement; positive moves down | 1 to 24px |
| blur | Softness of the edge; 0 is a hard edge | 2 to 60px |
| spread | Grows or shrinks the shadow before blurring | -8 to 8px |
| color | Any CSS color, and alpha is essential | rgba at 4–20% alpha |
| inset | Draws the shadow inside the box instead of outside | flag, no value |
The parameter people underuse is negative spread. A shadow with a slight negative spread pulls in from the element edges, which reads as the object being closer to the surface — a much more natural look for cards than the default.
Almost always because there is only one of them, and it is too dark.
A real shadow is not a single blur. Light comes from an area source, so an object casts a tight, dark contact shadow directly beneath it, and a broader, much softer ambient shadow spreading further out. Reproducing that needs at least two layers, and three is better.
The second mistake is opacity. A shadow at rgba(0,0,0,0.5) is far darker than anything in the physical world at that blur radius. Real elevation shadows sit between 4% and 20% alpha. If your card looks like it is floating in a void, halve the alpha and double the blur.
The third is color. Pure black shadows look dead because real shadows take on the color of the ambient light around them. Tinting the shadow toward the background hue — a deep navy on a navy page, rather than black — is what makes a UI feel considered.
Pick a light direction and keep it consistent across the entire interface, then define a small ladder of elevations rather than choosing shadows per component.
A three-layer recipe that works: a 1px hairline at low alpha for the contact edge, a medium blur at 6–10% for the main body, and a wide blur at 4–6% for the ambient spread. Scale all three together as elevation increases — higher objects cast larger, softer, fainter shadows and sit further from their contact shadow.
Five levels is enough for any interface: resting (0), raised (1), overlay (2), modal (3), and dragging (4). Material Design uses a similar ladder, and the discipline of a fixed set is what makes elevation read as a system rather than decoration.
box-shadow follows the element’s rectangular box, honoring border-radius but nothing else. filter: drop-shadow() follows the element’s actual rendered shape, including transparency in a PNG, the outline of an SVG path, and clipped shapes.
For a card or a button, use box-shadow — it is cheaper and it does what you want.
For a logo with transparency, an icon, or anything with a clip-path, use filter: drop-shadow(). A box-shadow on a transparent PNG produces a rectangle floating behind it, which is the giveaway of a shadow applied to the wrong property.
The trade is cost. drop-shadow is a filter operation and can force a repaint on animation, whereas box-shadow on a static element is comparatively cheap.
Add the inset keyword. Inner shadows are useful for pressed button states and for making inputs read as recessed.
Yes — comma-separate them in a single box-shadow declaration. The first listed renders on top.
The offset exceeds the blur radius, so part of the shadow extends beyond the softened region. Increase the blur or reduce the offset.
A style using two opposing shadows — a light one on the top-left and a dark one on the bottom-right — to make an element look extruded from the background. It has serious accessibility problems, because the contrast between element and background is by definition almost zero.
Static ones are cheap. Animating blur or spread forces repaints and is expensive; animate opacity or transform on a pre-rendered shadow layer instead.
Set the offset in that direction and use a negative spread roughly equal to the blur, which pulls the shadow back on the other three sides.
Between 4% and 20%, depending on elevation. Anything above 30% reads as artificial at normal blur radii.