スタイルtextDecorationプロパティ
例
要素のテキスト装飾を設定します。
document.getElementById("demo").style.textDecoration = "underline overline";
定義と使用法
textDecorationプロパティは、テキストの装飾を1つ以上設定または返します。
ヒント:要素に複数の装飾タイプを指定するには、スペースで区切られた装飾タイプのリストを指定します。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
textDecoration | Yes | Yes | Yes | Yes | Yes |
構文
textDecorationプロパティを返します。
object.style.textDecoration
textDecorationプロパティを設定します。
object.style.textDecoration = "none|underline|overline|line-through|blink|initial|inherit"
プロパティ値
Value | Description |
---|---|
none | Defines a normal text. This is default |
underline | Defines a line under the text |
overline | Defines a line over the text |
line-through | Defines a line through the text |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
技術的な詳細
デフォルト値: | なし |
---|---|
戻り値: | テキストに追加された装飾を表す文字列 |
CSSバージョン | CSS1 |
その他の例
例
要素のテキスト装飾を返します。
alert(document.getElementById("demo").style.textDecoration);
関連ページ
CSSチュートリアル:CSSテキスト
CSSリファレンス:text-decorationプロパティ
❮スタイルオブジェクト