O'Reilly logo

CSS Pocket Reference, 4th Edition by Eric A. Meyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

text-decoration

Values:

none | [ underline || overline || line-through || blink ]

Initial value:

none

Applies to:

All elements

Inherited:

No

Computed value:

Same as declared value

Description:

Defines text-decoration effects such as underlining. These decorations will span descendant elements that don’t have decorations of their own, in many cases making the child elements appear to be decorated. Combinations of the values are legal. Any time two text-decoration declarations apply to the same element, the values of the two declarations are not combined. For example:

h1 {text-decoration: overline;}
h1, h2 {text-decoration: underline;}

Given these styles, h1 elements will be underlined with no overline because the value of underline completely overrides the value of overline. If h1 should have both overlines and underlines, use the value overline underline for the h1 rule and move it after the h1, h2 rule or extend its selector to raise its specificity.

User agents are not required to support blink.

Examples:

u {text-decoration: underline;}
.old {text-decoration: line-through;}
u.old {text-decoration: line-through underline;}

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required