Visit Mozilla.org

CSS:text-decoration

From MDC

« CSS Reference

[edit] Summary

The text decoration property is used to set text decoration (formatting) like underline, blink, line-through etc.

[edit] Syntax

text-decoration: none | [ underline || overline || line-through || blink ] | inherit

[edit] Values

  • none : Specifies that no text decoration is to be used.
  • underline : Underlines text.
  • overline : Places a line over the text.
  • line-through : Places a line(strike) through the text.
  • blink : Causes the text to blink.

[edit] Examples

View Live Examples

p{text-decoration: line-through;}

p{text-decoration: underline;} 

[edit] Notes

Text decorations draw across descendant elements. This means that it is not possible to disable on a descendant a text decoration that is specified on one of its ancestors. For example, in the markup:

 <p>This text has <em>some emphasized words</em> in it.</p>

the style rule:

 p { text-decoration: underline }

would cause the entire paragraph to be underlined. However, the style rule:

 em { text-decoration: none }

would not cause any change; the entire paragraph would still be underlined. (However, the rule

 em { text-decoration: overline }

would cause a second decoration to appear on "some emphasized words".)

[edit] Specifications

[edit] Browser compatibility

Browser Lowest Version
Internet Explorer 3
Netscape 4
Opera 3.5

[edit] See also

text-indent, text-align, text-decoration, letter-spacing, word-spacing, text-transform, white-space, white-space-collapse, text-rendering, text-wrap, text-shadow