CSS Box Shadow Generator

Generate CSS3 Box-Shadow Property
Page Background:
Object Background:
×
 
Effects gallery - choose any example effect

About box-shadow

The CSS box-shadow property adds one or more shadows to an element. To specify multiple shadows, you must add an additional value for the shadow (s), separated by commas. Virtually any element can obtain a shadow using this property. Box-shadow allows you to easily implement multiple shadows (external or internal) on elements, specifying color, size, blur and offset values.

CSS syntax

offset-x | offset-y | color
offset-x | offset-y | blur-radius | color
offset-x | offset-y | blur-radius | spread-radius | color
inset | offset-x | offset-y | color

Example

box-shadow: 50px -16px cyan;
box-shadow: 9px 10px 10px red;
box-shadow: 3px 5px 4px 2px rgba(0, 0, 0, 0.5);
box-shadow: inset 4em 1em green;
box-shadow: 5px 5px red, -1em 0 0.4em blue;

JavaScript syntax

object.style.boxShadow = "10px 5px 5px red"

Browser Support

Support for browsers is growing lately with Mozilla (Firefox), Webkit (Safari / Chrome / Konqueror), Opera and the IE9 platform preview, all of which offer a decent implementation of the specification, although Mozilla and Webkit (older versions specified in table below) still require their respective -moz- and -webkit - prefixes (note that Mozilla Firefox 4.0+ no longer requires the -moz- prefix).

Browser name, version and version with -webkit- or -moz- prefix that fully supports the box-shadow property.

Property
Chrome
Chrome
IE/Edge
IE/Edge
Firefox
Firefox
Safari
Safari
Opera
Opera
box-shadow 10
1 (with prefix: -webkit-)
9 4
3.5 (with prefix: -moz-)
5.1
3 (with prefix: -webkit-)
10.5
inset 10
1 (with prefix: -webkit-)
9 4
3.5 (with prefix: -moz-)
5.1
5 (with prefix: -webkit-)
10.5
Multiple shadows 10
1 (with prefix: -webkit-)
9 4
3.5 (with prefix: -moz-)
5.1
3 (with prefix: -webkit-)
10.5
Spread radius 10
1 (with prefix: -webkit-)
9 4
3.5 (with prefix: -moz-)
5.1
5 (with prefix: -webkit-)
10.5

Properties and Values

When working with CSS, the box-shadow property allows the use of two to four numeric values for one shadow. For compulsory values for this properties are only the location of the horizontal and vertical shadows. It is allowed to use negative values in them. By optional values include a value shadow color (default black), the blur radius (default: 0, Negative values are not allowed) and the size of the shadow, or spread-radius (default 0). Please note that if you do not specify optional values, they will be set to the default values (h-shadow v-shadow black 0 0).

inset (Optional)

If the keyword 'inset' not specified, the shadow will be on the outside of the element (and will create the effect of convexity of the block). If you set keyword 'inset', the shadow will fall inside the block and create the effect of indentation of the block. In other words, this is a change from the outer shadow to the inner.

Horizontal length (Mandatory value)

Sets the location of the horizontal shadow or offset shadow horizontally (<offset-x>). Negative values are allowed.

Vertical length (Mandatory value)

Sets the location of the vertical shadow or offset shadow vertically (<offset-y>). Negative values are allowed.

blur-radius (Optional)

The blur radius defines the hardness or softness of the shadow. The lower the value, the sharper the shadow. A high value will create a large blur. It admits any value, but the negatives are interpreted as Zero (0).

spread-radius (Optional)

Another length value, can be positive or negative, and defines how far the shadow will propagate (beyond what is defined by offset). A negative value will make the shadow smaller, more compressed.

Color (Optional)

You can choose to express it in any of the allowed forms (hexadecimal or rgba). In the example, the value expressed in rgba (rgb + alpha channel of transparency) and if not specified, the color depends on the browser. In Gecko (Firefox), Presto (Opera) and Trident (Internet Explorer), the value of the color property is used, however, the Shadow of WebKit is transparent and therefore useless if the color is omitted.