Little Web Hut

CSS 2.1 Reference: text-decoration Property

CSS text-decoration Property
Syntax
selector {text-decoration: underline overline line-through blink;}
  • underline, overline, line-through, and blink are all OPTIONAL keywords but at least one of them must occur.
(OR)
selector {text-decoration: value;}
  • value is specified by using one of the following keywords: none or inherit.
Usage

The text-decoration property is used to add a decoration to text.

This property is specified by using one or more keywords according to the syntax shown above.


CSS Example: The text-decoration property is set to underline.
  span {text-decoration: underline;}
Test It HTML StyleTest It XHTML StyleTest It HTML5 Style

Keywords
  • underline - Underlines the text like in this sample.
  • overline - Places a line over the text like in this sample.
  • line-through - Places a line through the text like in this sample.
  • blink - Causes the text to blink like in this sample. The blink keyword may not be supported by some browsers.
  • none - No decoration.
  • inherit - The inherit keyword is used to specify that the value for this property should be taken from the parent element. If inherit is used with the root element, then the initial value for this property will be used.
Applies To All elements
Inherited No
Initial Value none


text-decoration Property Examples
Test It HTML StyleTest It HTML StyleTest It HTML5 StyleThe text-decoration property is set to underline.