Name

text-decoration

Values:

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

Initial value:

none

Applies to:

All elements.

Inherited:

No.

Computed value:

As specified.

Description:

This property allows certain text effects such as underlining. These decorations will span descendant elements that don’t have decorations of their own. User agents are not required to support blink. They will span child elements, which do not have text decoration defined; for more details, see Chapter 6 of CSS: The Definitive Guide, Third Edition (O’Reilly). 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 overline completely overrides the value of underline. 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.

Examples:

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

Supported by:

Firefox, Internet Explorer, Opera, Safari.

Notes:

Explorer does not support the blink value. There may be inconsistent results regarding text decoration spanning child elements (see Description).

Get CSS Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.