将 box-shadow 添加到 div 元素:
document.getElementById("myDIV").style.boxShadow = "10px 20px 30px blue";
亲自试一试 »
boxShadow 属性设置或返回框元素的阴影。
Property | |||||
---|---|---|---|---|---|
boxShadow | Yes | 9.0 | Yes | 5.1 | Yes |
返回 boxShadow 属性:
object.style.boxShadow
设置 boxShadow 属性:
object.style.boxShadow = "none|
h-shadow v-shadow blur spread color |inset|initial|inherit"
笔记:boxShadow 属性将一个或多个阴影附加到框上。该属性是一个以逗号分隔的阴影列表,每个阴影由 2-4 个长度值、一个可选颜色和一个可选 inset 关键字指定。省略的长度为 0。
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 shadow |
color | Optional. The color of the shadow. The default value is black. Look at CSS Color Values for a complete list of possible color values. Note: In Safari (on PC) the color parameter is required. If you do not specify the color, the shadow is not displayed at all. |
inset | Optional. Changes the shadow from an outer shadow (outset) to an inner shadow |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
默认值: | 没有任何 |
---|---|
返回值: | 一个字符串,表示元素的 box-shadow 属性 |
CSS版本 | CSS3 |
CSS 参考:盒子阴影属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!