備忘録的プログラミングリファレンス

text-decoration プロパティ

 text-decoration プロパティは、テキストに下線、上線、取り消し線、2重線などを指定する CSS プロパティです。 色や線種(スタイル)も指定することができます。

赤い波の下線(Exampleを参照
text-decoration: underline red wavy;
表示例

text-decorationの例です。

 CSS では、text-decoration プロパティはテキストへの装飾という扱いです。 テキストに赤い下線を付けるといったことができます。

 text-decoration プロパティは以下のプロパティの一括指定ができます。

 text-decoration-line プロパティの値は必ず指定する必要があります。

マーカーのような線を加えるにはbackgroundプロパティlinear-gradient()関数を使います。

ページ内 Index

構文(Syntax)

CSS

text-decoration: [ text-decoration-line text-decoration-color text-decoration-style ] | initial | inherit;

DOM ( JavaScript )

値の取得
String = object.style.textDecoration;
値の設定
object.style.textDecoration="[ text-decoration-line text-decoration-color text-decoration-style ] | initial | inherit";

値(Values)

Value摘要
text-decoration-line下線、上線、取り消し線、2重線など
text-decoration-color線の色、CSS Colorを参照のこと
text-decoration-style線の種類、点線、破線など
initial初期値に戻す
inherit親エレメントのプロパティを継承

備考(Remarks)

初期値(Default value)none currentcolor solid
継承(Inherited)No
CSS AnimationNo

Example

 text-decorationの例です。テキストに赤い下線を付けるといったことに便利です。