CSS: Box Shadow
Interactive Box Shadow Generator
Offset x:
Offset y:
Offset length
Offset direction
blur
spread
Syntax
box-shadow: xOffset yOffset color
box-shadow: xOffset yOffset blur color
box-shadow: xOffset yOffset blur spread color
box-shadow: inset xOffset yOffset blur spread color
box-shadow: ShadowSpec1, ShadowSpec2 …
Simple Box Shadow
Here is a simple box shadow:
SHADOW!
Here is the CSS code:
div { box-shadow: 5px 5px red }
Blur
Here are boxes with increasing blur value.
box-shadow:3px 3px blurpx red
0
2
4
6
8
10
Spread
Here are boxes with increasing spread value.
box-shadow:5px 5px 0px spreadpx red
-2
0
2
4
6
Inset Box Shadow
“inset” box shadow makes the shadow go inside the box. All other parameters are the same.
Examples:
box-shadow: inset 3px 3px red;
box-shadow: inset 0px 0px 20px 5px red;
box-shadow: inset 5px 5px 5px 0px grey;
Multiple Shadow with Inset
box-shadow:
inset 0px 0px 4px 3px red,
0px 0px 4px 3px blue;
Multiple Box Shadows
multi box lunch
#multi18462 { display:table; border-radius:9px; padding:3px; margin:50px; box-shadow: 8px 6px 13px 8px red, -16px 12px 20px 16px yellow, 48px 36px 71px 28px cyan; }
Browser Support
Box shadow is supported in all browsers, as of 2012-04-20.