CSS3 box-shadow property
Example
Add a shadow to a div element:
div
{
box-shadow:
10
px
10
px
5
px
#888888
;
}
Try it »
View more examples at the bottom of this page.
Browser support
The numbers in the table indicate the first browser version that supports this property.
A number immediately before -webkit-, -ms-, or -moz- indicates the first browser version that supports that prefixed property.
| property | |||||
|---|---|---|---|---|---|
| box-shadow | 10.0 -webkit- | 9.0.0 | 4.0 (2.0)[3] |
3.5(1.9.1)
-moz | 5.1[1]
3.0
-webkit | 10.5[1]
-o- |
Property definition and usage
The box-shadow property can set one or more drop shadows on an element.
| Default value: | none |
|---|---|
| Inherited: | no |
| Version: | CSS3 |
| JavaScript syntax: | object.style.boxShadow="10px 10px 5px #888888" |
Syntax
box-shadow:
h-shadow v-shadow blur spread color
inset;
**Note:** The boxShadow property adds one or more drop shadows to a box. This property is a comma-separated list of shadows, where each shadow is specified by 2 to 4 length values, an optional color value, and an optional inset keyword. Omitted length values default to 0.
| Value | Description |
|---|---|
| h-shadow | Required. The position of the horizontal shadow. Negative values are allowed |
| v-shadow | Required. The position of the vertical shadow. Negative values are allowed |
| blur | Optional. The blur distance |
| spread | Optional. The size of the shadow |
| color | Optional. The color of the shadow. InCSS color valuesFind a complete list of color values |
| inset | Optional. Changes the inner shadow from the outer shadow (at the beginning) |
Online example
Rotate an image
This example demonstrates how to create a "polaroid" photo and rotate the image.
Related Articles
CSS3 tutorial: CSS3 Borders