スタイルtextDecorationLineプロパティ
例
テキストを通る線で要素を表示します。
document.getElementById("demo").style.textDecorationLine = "line-through";
定義と使用法
textDecorationLineプロパティは、装飾に含まれる線のタイプを設定または返します。
注: textDecorationLineプロパティを使用してtextDecorationLineを設定することもできます。これは、textDecorationLine、textDecorationStyle、およびtextDecorationColorプロパティの省略形のプロパティです。
注:下線や上線など、複数の値を組み合わせて、テキストの下と上に線を表示することもできます。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
textDecorationLine | 57.0 | 79.0 | 36.0 6.0 Moz |
7.0 Webkit | 44.0 |
構文
textDecorationLineプロパティを返します。
object.style.textDecorationLine
textDecorationLineプロパティを設定します。
object.style.textDecorationLine = "none|underline|overline|line-through|initial|inherit"
プロパティ値
Value | Description |
---|---|
none | Default value. Specifies no line for the text-decoration |
underline | Specifies that a line will be displayed under the text |
overline | Specifies that a line will be displayed over the text |
line-through | Specifies that a line will be displayed 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 |
技術的な詳細
デフォルト値: | なし |
---|---|
戻り値: | 要素のtext-decoration-lineプロパティを表す文字列 |
CSSバージョン | CSS3 |
関連ページ
CSSリファレンス:text-decoration-lineプロパティ
❮スタイルオブジェクト