YouTip LogoYouTip

Prop Style Boxshadow

HTML DOM Style boxShadow Property

HTML DOM Style boxShadow Property

-- Learning is not just about technology, but also about dreams!

JavaScript Reference Manual

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

<source>

HTML DOM Table Object

Style boxShadow Property

Style Object Reference Manual Style Object

Example

Add a shadow to a div element:

document.getElementById("myDIV").style.boxShadow="10px 20px 30px blue";

Try it yourself Β»


Definition and Usage

The boxShadow property sets or returns the drop shadow of an element.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The boxShadow property is supported in IE9+, Firefox, Chrome, Opera, and Safari 5.1.1.


Syntax

Get the boxShadow property:

_object_.style.boxShadow

Set the boxShadow property:

_object_.style.boxShadow="none|_h-shadow v-shadow blur spread color_|inset|initial|inherit"

Note: The boxShadow property adds one or more drop shadows to the box. The property is a comma-separated list of shadows, each shadow defined by 2-4 length values, an optional color value, and an optional inset keyword. Omitted lengths default to 0.

Property Values

Value Description
none Default value. No shadow is displayed.
_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. The default value is black. For a complete list of possible color values, see CSS Color Values. Note: In Safari (on PC), the color parameter is required. If you do not specify a color, no shadow is displayed.
inset Optional. Changes the shadow from an outer shadow (outset) to an inner shadow.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical Details

Default Value: none
Return Value: A string, representing the box-shadow property of the element.
CSS Version: CSS3

Related Articles

CSS Reference: box-shadow Property


Style Object Reference Manual Style Object

← Prop Style BoxsizingProp Style Bordertoprightradiu β†’