CSS/Properties/text-decoration

From W3C Wiki
< CSS‎ | Properties
Revision as of 18:00, 16 June 2011 by Hiroki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

text-decoration

The text-decoration property describes decorations that are added to the text of an element using the element's color.

Description

Values none | [ underline || overline || line-through || blink ] | inherit
Initial value none
Applies to All elements
Inherited No


Point, Note

  • The decoration's color be set by the color property.


Values

  • none
    Produces no text decoration.


  • underline
    Each line of text is underlined.


  • overline
    Each line of text has a line above it.


  • line-through
    Each line of text has a line through the middle.


  • blink
    Text blinks (alternates between visible and invisible).


  • inherit
    Takes the same specified value as the property for the element's parent.


Example

Example A

[style.css]

p#no{ text-decoration: none; }
p#un{ text-decoration: underline; }
p#ov{ text-decoration: overline; }
p#th{ text-decoration: line-through; }
p#bl{ text-decoration: blink; }

[index.html]

<body>
  <p id="no">This is a paragraph(none)</p>
  <p id="un">This is a paragraph(underline)</p>
  <p id="ov">This is a paragraph(overline)</p>
  <p id="th">This is a paragraph(line-through)</p>
  <p id="bl">This is a paragraph(blink)</p>
<body>

Csslist2 text-decoration.png

CSS Reference

The CSS specification defines the text-decoration property in 16.3.1 Underlining, overlining, striking, and blinking.