CSSテキスト装飾プロパティ
例
<h1>、<h2>、および<h3>要素に異なるテキスト装飾を設定します。
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
h4 {
text-decoration: underline
overline;
}
以下の「自分で試してみてください」の例をもっと見てください。
定義と使用法
このtext-decoration
プロパティは、テキストに追加される装飾を指定し、次の省略形のプロパティです。
- text-decoration-line(必須)
- テキスト-装飾-色
- テキスト装飾スタイル
デフォルト値: | なしcurrentcolorソリッド |
---|---|
遺伝性の: | いいえ |
アニメート可能: | いいえ、個々のプロパティを参照してください。アニメート可能について読む |
バージョン: | CSS1、CSS3で更新 |
JavaScript構文: | オブジェクト.style.textDecoration = "underline" |
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
Property | |||||
---|---|---|---|---|---|
text-decoration | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
CSS構文
text-decoration: text-decoration-line text-decoration-color
text-decoration-style|initial|inherit;
プロパティ値
Value | Description |
---|---|
text-decoration-line | Sets the kind of text decoration to use (like underline, overline, line-through) |
text-decoration-color | Sets the color of the text decoration |
text-decoration-style | Sets the style of the text decoration (like solid, wavy, dotted, dashed, double) |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
その他の例
例
テキスト装飾を追加します。
h1 {
text-decoration: underline overline dotted red;
}
h2 {
text-decoration: underline overline wavy
blue;
}
関連ページ
CSSチュートリアル:CSSテキスト
HTML DOMリファレンス:textDecorationプロパティ