<h1>, <h2>, and <h3> 要素へテキスト装飾を設定します:
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
Try it Yourself ❯
text-decoration プロパティは、テキストに装飾(線)の追加を指定します。
注: CSS3 において、text-decorationプロパティは text-decoration-line および text-decoration-style のショートハンドプロパティですが、 現在、これをサポートする主要なブラウザはありません。
注: CSS3 では、装飾(線)の色の変更には text-decoration-color プロパティ を使用できますが、CSS3 以外では、テキスト色と同じ色が設定されます。
デフォルト値: | なし |
---|---|
継承: | 継承する |
アニメーション可否: | no, 個別のプロパティを参照してください. animatable を参照 |
バージョン: | CSS1, renewed in CSS3 |
JavaScript 構文: | object.style.textDecoration="underline" Try it |
表中の数字は、完全にプロパティをサポートした最初のブラウザのバージョンです。
プロパティ | |||||
---|---|---|---|---|---|
text-decoration | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
text-decoration: none|underline|overline|line-through|initial|inherit;
値 | 説明 | Play it |
---|---|---|
なし | 通常のテキストを定義します。これがデフォルトです | Play it ❯ |
underline | テキストの下に線を定義します | Play it ❯ |
overline | テキストの上に線を定義します | Play it ❯ |
line-through | テキストの打消し線を定義します | Play it ❯ |
initial | プロパティにデフォルト値を設定します。initial を参照 | Play it ❯ |
inherit | このプロパティは親要素を継承します。inherit を参照 |
CSS チュートリアル: CSS Text
HTML DOM リファレンス:textDecoration プロパティ