Set the offset, blur, spread and color of a shadow, see it under a sample card and copy the box-shadow line.
FluffyShieldProtected workspace
Loading the tool…
The tool didn't load. Reload the page, or check whether an extension or network filter blocks .
Free · No upload · No sign-up · No usage quotas
What does the spread value in box-shadow do?
It moves the edge of the shadow before the blur softens it. A few pixels of negative spread are how a card ends up with its shadow mostly underneath.
FluffyBench · 4 min read · Reviewed
A paper cut-out behind the card
Say you want a card to look as if it floats a little above the page, and someone hands you box-shadow: 0px 8px 24px -4px rgba(0, 0, 0, 0.2);. Most of it reads easily: nothing sideways, 8 pixels down, a wide blur, black at 20% strength. Then there's that -4px.
The shadow is a dark paper cut-out of the card, lying behind it. The two offsets slide the paper: the first to the right, the second down, and negative numbers the other way. A positive spread cuts the paper bigger than the card by that many pixels all round; a negative one trims it smaller.
Only after the paper is cut and placed does the blur fade its edge. The CSS specification says how far: the fade is about twice the blur long, centred on the paper's edge. Half of it lies outside the edge and half lies inside.
Where the shadow's edge ends up
Spread 0px
Spread -4px
The dashed line is where the shadow's edge sits before the blur. The shadows are drawn at full strength here instead of 20% so the whole fade can be seen. How we worked it out
Without any spread, the paper is the card's size. Moved 8 pixels down, its top edge sits 8 pixels below the top of the card, and its bottom edge 8 pixels below the card's bottom. The fade runs 24 pixels out from those edges, so the shadow shows 16 pixels above the card, 24 at each side and 32 below.
Trim the paper by 4 pixels all round and the edges move in. At the sides the edge is now 4 pixels inside the card, so the shadow shows 20 pixels out instead of 24. At the top it's 12 pixels inside, and all that shows above the card is the faint last 12 pixels of the fade. At the bottom the edge is still 4 pixels below the card, and the shadow carries on 28 pixels down.
That's the trick of a small negative spread: it pulls the shadow in where the card has no reason to cast one, and leaves it below, where a lamp above the page would put it.
Setting up the card's shadow in the box above
Above is the Box shadow mode of FluffyBench CSS Generator, starting from a purple shadow that falls down and to the right. Swap in the card's numbers one field at a time.
Type 0 in Offset X.
Type 8 in Offset Y.
Type 24 in Blur.
Type -4 in Spread.
Type #000000 in the Color box, in place of the purple.
Type 0.2 in Opacity.
Press Copy CSS.
Copy CSS hands back the line from the start of this page. Notice that the opacity has gone into the color: a shadow below full strength is written as rgba(), with its strength as the last number, whichever way you typed the color.
Ticking Inset puts the same shadow inside the card, as if the card were pressed into the page, and the line then starts with the word inset.
A clip-path cuts the card to that shape. It cuts away everything the card paints outside the shape, this shadow included, so the shadow then needs an element of its own behind the card.