スタイルtextShadowプロパティ
例
テキストに影を追加します。
document.getElementById("demo").style.textShadow = "5px 5px 1px #ff0000, 10px 10px 1px #0000ff";
定義と使用法
textShadowプロパティは、テキストに対して1つ以上のシャドウ効果を設定または返します。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
textShadow | Yes | 10.0 | Yes | Yes | Yes |
構文
textShadowプロパティを返します。
object.style.textShadow
textShadowプロパティを設定します。
object.style.textShadow = "none|h-shadow v-shadow blur color|initial|inherit"
注: textShadowプロパティは、1つ以上の影をテキストに添付します。プロパティは、コンマで区切られたシャドウのリストであり、それぞれ2つまたは3つの長さの値と、オプションの色で指定されます。省略された長さは0です。
プロパティ値
Value | Description |
---|---|
none | No shadow is drawn. This is default |
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 |
color | Optional. The color of the shadow. Look at CSS Color Values for a complete list of possible color values |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
技術的な詳細
デフォルト値: | なし |
---|---|
戻り値: | 要素のテキストに適用されるシャドウ効果のコンマ区切りリストを表す文字列 |
CSSバージョン | CSS3 |
その他の例
例
テキストの影を返します。
alert(document.getElementById("myP").style.textShadow);
関連ページ
CSSチュートリアル:CSS3テキスト効果
CSSリファレンス:text-shadowプロパティ
❮スタイルオブジェクト