CSS Box Shadow Generator
WM-23Change the offset, blur, spread, color and opacity and watch the preview box update. The CSS below the preview is exactly what draws it, ready to copy.
Runs in your browser. Nothing is uploaded.
Shadow
Preview and CSS
| box-shadow | 0 8px 24px -4px rgba(17, 17, 17, 0.3) |
|---|---|
| Tailwind class | shadow-[0_8px_24px_-4px_rgba(17,17,17,0.3)] |
CSS
.box {
background: #ffffff;
box-shadow: 0 8px 24px -4px rgba(17, 17, 17, 0.3);
} How to use it
- Set the horizontal and vertical offset in pixels. Positive numbers move the shadow right and down.
- Adjust blur, spread, shadow color and opacity until the preview looks right.
- Switch Type to Inner (inset) for a pressed or recessed look, and set the box and background colors to match your page.
- Press Copy to take the CSS, or copy the box-shadow value or Tailwind class from the results.
What each box-shadow value does
The box-shadow property takes up to four lengths and a color: horizontal offset, vertical offset, blur radius and spread radius. Offsets move the shadow; negative values move it left or up. Blur softens the edge and cannot be negative. Spread grows the shadow on every side, or shrinks it when negative, which is how you get a soft shadow that does not show at the sides. The keyword inset draws the shadow inside the box instead of outside.
Subtle shadows read better
Shadows look most natural when they fall slightly down, are soft, and use a dark color at low opacity rather than solid black. A small negative spread keeps the shadow tucked under the box. On a dark page, a shadow needs a higher opacity to be seen, or a lighter background behind the box. Check the preview against the background color you will really use; you can set it in the Background field.
Questions people ask
How do I add more than one shadow?
box-shadow accepts a comma separated list. Make each layer here, copy each value, and join them with commas in one declaration.
Does box-shadow affect layout or element size?
No. Shadows are painted outside the layout, so they never move other elements, but they can be clipped by a parent with overflow hidden.
What is the difference between box-shadow and drop-shadow?
box-shadow follows the element's box and border radius. The CSS filter drop-shadow follows the visible shape, including transparent parts of images, but has no spread or inset.
Which browsers support box-shadow?
Every current browser supports box-shadow without a vendor prefix, so the CSS here needs no -webkit- line for modern sites.
Is the Tailwind class the same as the CSS?
Yes. It is an arbitrary value class that writes the same box-shadow, with spaces replaced by underscores as Tailwind requires.
About this tool
Builds a single box-shadow layer from offset, blur, spread, color and opacity. Colors with less than full opacity are written as rgba(), and zero lengths are written as 0. The preview box uses exactly the CSS shown, so what you see is what you copy. The Tailwind line is an arbitrary value class for Tailwind CSS 3 or later. To stack several shadows, copy each value and join them with commas.