CSS Shadow Generator

Presets
Shadow Layers
Shape: BG: Size:
CSS

Box-Shadow Syntax Reference

The CSS box-shadow property adds one or more shadow effects to an element. Syntax:

box-shadow: [inset] <offset-x> <offset-y> [blur] [spread] <color>;

Property Breakdown

ValueDescriptionDefault
offset-xHorizontal offset. Positive = right, negative = leftRequired
offset-yVertical offset. Positive = down, negative = upRequired
blur-radiusBlur radius. Larger = softer, more diffused shadow0
spread-radiusSpread radius. Positive = expand, negative = shrink0
colorShadow color, supports rgba() for transparencyText color
insetChanges outer shadow to inner. Used for pressed effectsNone (outer)

Browser Compatibility

box-shadow has full support in all modern browsers (Chrome 10+, Firefox 4+, Safari 5.1+, Edge 12+). For legacy WebKit browser support, add the -webkit-box-shadow prefix. Most modern projects no longer need it.

Performance Tips

FAQ

What is the difference between box-shadow and drop-shadow?

box-shadow follows the element's rectangular box model. filter: drop-shadow() follows the element's actual visible shape including alpha transparency, making it ideal for PNG icons and irregular shapes.

How do I create multi-layered shadows?

Separate multiple shadow values with commas: box-shadow: 0 2px 4px rgba(0,0,0,.1), 0 8px 16px rgba(0,0,0,.1); The first layer renders on top. Multiple soft layers produce more realistic lighting than a single hard shadow.

Does box-shadow affect page layout?

No. box-shadow is purely visual โ€” it does not affect document flow, element dimensions, or adjacent element positions. However, large shadow spread may overflow the parent container's visible area (clip with overflow:hidden).

How can I show shadow on only one side?

Combine offset with negative spread to create single-direction shadows. For bottom-only: box-shadow: 0 4px 6px -2px rgba(0,0,0,.2); Negative spread shrinks the shadow while positive y-offset pushes it downward.

๐Ÿ’ฌ Comments