CSS text-decoration Property

CSS text-decoration property sets the text formatting of an element such as text-decoration-line, text-decoration-color and text-decoration-style.

Usages

The following table outline the usages and version history of this property.

Default value: none
Applies to: All elements
Inherited: Yes
Version: CSS1
JavaScript Syntax: object.style.textDecoration = "underline wavy red"

Syntax

Here is a syntax for the CSS text-decoration property

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

Property Values

The following table describes the values of this property.

Value Description
decoration-line Required. Set decoration line such as underline, overline, line-through, and blink
decoration-style Set decoration style such as solid, double, dotted, dashed, and wavy
decoration-color Set decoration color
initial Sets default value of this property
inherit Inherits this property from its parent element

Examples

The example below shows to sets text-decoration property.

p.one {
  text-decoration: overline;
}
p.two {
  text-decoration: line-through;
}
p.three {
  text-decoration: underline;
}
p.four {
  text-decoration: underline overline;
} 
p.five {
  text-decoration: wavy overline red;
}

Run it...   »

Browser Compatibility

  • Google Chrome 1+
  • Mozilla Firefox 1+
  • Internet Explorer 3+
  • Opera 3.5+
  • Safari 1+

Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.