How to use it
The page opens on the Raised preset under a white card. Start from Subtle, Raised or Soft, or build your own.
- Each Layer box has sliders in whole pixels: X and Y from -40 to 40, Blur from 0 to 60 and Spread from -20 to 20. Positive X moves the shadow right, positive Y moves it down.
- Type the layer’s color into Color: hex,
rgb(),hsl()or a name liketomato. The round swatch beside it picks an opaque 6-digit hex. - Tick Inset, drawn inside the edge for an inner shadow. Add layer adds one, up to 6, and Remove deletes one.
- Check the preview on White, Grey, Dark, Checker or a color of your own.
Copy the value under box-shadow with Copy CSS, or the class under Tailwind with Copy Tailwind. If a color can’t be read, a message names the layer and the problem, and the page keeps the last shadow that worked.
Examples
A shadow under the bottom edge only, with Y 8, Blur 6, Spread -6 and rgb(0 0 0 / 40%):
0px 8px 6px -6px rgb(0 0 0 / 40%)
shadow-[0px_8px_6px_-6px_rgb(0_0_0_/_40%)]
The negative spread shrinks the shadow 6px on every side, and the 8px drop pushes only its bottom edge back out past the card.
A two-ring focus outline: layer 1 with Spread 2 and #ffffff, layer 2 with Spread 4 and #3b82f6, both with Blur 0:
0px 0px 0px 2px #ffffff, 0px 0px 0px 4px #3b82f6
Layer 1 paints on top, so you see 2px of white, then 2px of blue. Swap the layers and the blue ring hides the white one.
A color with the alpha in the wrong place, rgb(0 0 0 0.4), is rejected:
Layer 1: In the modern shape the alpha goes after a "/", as in rgb(255 87 51 / 0.5).
Space-separated rgb() takes its alpha after a slash; the comma form rgba(0, 0, 0, 0.4) also works, but not a mix of the two.
Good to know
- Each layer is
inset? x y blur spread color, from CSS Backgrounds and Borders Level 3. Browsers also accept a bare0, the color first, and a missing blur or spread, which counts as 0. Of comma-separated layers, the first is drawn on top. - Blur can’t be negative; spread can. The spec asks for a Gaussian blur with a standard deviation of half the blur value. Spread grows the shape before blurring, or shrinks it when negative.
- Shadows take no space. They don’t change layout or add scrollbars, and an ancestor with
overflow: hiddencuts them off, so give that container padding. - Shadows follow
border-radius. An outer shadow is painted only outside the border box, so a translucent card doesn’t show its own shadow through it. An inset shadow is painted inside the padding box, over the background and under the content. - The color is copied as typed. Accepted: hex with 3, 4, 6 or 8 digits (
#RRGGBBAAis from CSS Color 4),rgb(),rgba(),hsl()andhsla()in comma or slash form, the 148 named colors,transparentandcurrentColor.oklch(),color-mix()andvar(--…)are rejected, though browsers support them. Out-of-range channels aren’t flagged; CSS clamps them. - Bare numbers in
hsl()are percentages. CSS Color 4 lets the space-separated form writehsl(210 50 40)forhsl(210 50% 40%), so0.5there is 0.5%, not half. The comma form needs%. - The Tailwind class is an arbitrary value. Tailwind turns each
_back into a space at build time, and it finds classes by scanning your files as text, so the class must appear whole in the source. - A shadow has 1 to 6 layers, and a color is at most 120 characters.
Questions
How do I add a box shadow in CSS?
Set box-shadow on the element: box-shadow: 0 4px 8px rgb(0 0 0 / 20%); is a shadow 4px down with an 8px blur in 20% black. An optional spread goes after the blur.
How do I add a shadow only to the bottom of an element?
Use a downward offset and a negative spread of about the same size, such as 0 8px 6px -6px rgb(0 0 0 / 40%). The spread pulls the sides and top in under the element, so only the bottom edge shows.
How do I use a custom box shadow in Tailwind?
Use an arbitrary value with underscores for spaces, like shadow-[0px_8px_6px_-6px_rgb(0_0_0_/_40%)]. To reuse it by name in Tailwind v4, put --shadow-card: 0 8px 6px -6px rgb(0 0 0 / 40%); inside @theme to get shadow-card; in v3, add card under theme.extend.boxShadow.
How do I make an inner shadow in CSS?
Start the layer with inset. With the inset box ticked, Y 2, Blur 4 and #0000001f, the value is inset 0px 2px 4px 0px #0000001f: a soft shade inside the top edge.