Latest web development tutorials

HTML DOM Style boxShadow property

Style Object Reference Style Objects

Examples

Adding to the div element shadow:

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

try it"

Definition and Usage

boxShadow property sets or returns drop shadow elements.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

IE9 +, Firefox, Chrome, Opera and Safari 5.1.1 support boxShadow property.


grammar

Back boxShadow properties:

object .style.boxShadow

Setting boxShadow properties:

object .style.boxShadow="none|h-shadow v-shadow blur spread color |inset|initial|inherit"

Note: boxShadow property to add one or more drop shadow to the frame.The property is a comma-separated list of shadow, each shaded by a 2-4 length values, an optional color value and an optional inset keyword specified. Omitting length value is 0.

Property Value

描述
none 默认值。不显示阴影。
h-shadow 必需。水平阴影的位置。允许负值。
v-shadow 必需。垂直阴影的位置。允许负值。
blur 可选。模糊距离。
spread 可选。阴影的尺寸。
color 可选。阴影的颜色。默认值是黑色。如需了解可能的颜色值的完整列表,请参阅 CSS 颜色值

注意: 在 Safari(在 PC 上)浏览器中,color 参数是必需的。如果您未指定颜色,则不显示阴影。
inset 可选。将外部阴影(outset)改为内部阴影。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: none
return value: String representing the box-shadow property element.
CSS version CSS3


related articles

CSS Reference Manual: Box-Shadow property


Style Object Reference Style Objects