スタイルboxShadowプロパティ
例
ボックスシャドウをdiv要素に追加します。
document.getElementById("myDIV").style.boxShadow = "10px 20px 30px blue";
定義と使用法
boxShadowプロパティは、ボックス要素のドロップシャドウを設定または返します。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
boxShadow | Yes | 9.0 | Yes | 5.1.1 | Yes |
構文
boxShadowプロパティを返します。
object.style.boxShadow
boxShadowプロパティを設定します。
object.style.boxShadow = "none|h-shadow v-shadow blur spread color |inset|initial|inherit"
注: boxShadowプロパティは、1つ以上のドロップシャドウをボックスにアタッチします。プロパティは、コンマで区切られたシャドウのリストであり、それぞれ2〜4の長さの値、オプションの色、およびオプションのインセットキーワードで指定されます。省略された長さは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リファレンス:box-shadowプロパティ
❮スタイルオブジェクト