CSS text-decoration Property


Set the text decoration for <h1>, <h2>, and <h3> elements:

h1 {
    text-decoration: overline;

h2 {
    text-decoration: line-through;

h3 {
    text-decoration: underline;

Try it yourself »

Definition and Usage

The text-decoration property specifies the decoration added to text.

Note: In CSS3, the text-decoration property is a shorthand property for text-decoration-line, text-decoration-color, and text-decoration-style, but this is currently not supported in any of the major browsers.

Note: In CSS3 you can use the text-decoration-color property to change the color of the decoration, otherwise the color is the same as the color of the text.

Default value: none
Inherited: no
Animatable: no, see individual properties. Read about animatable
Version: CSS1, renewed in CSS3
JavaScript syntax: object.style.textDecoration="underline" Try it

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

text-decoration 1.0 3.0 1.0 1.0 3.5 

CSS Syntax

text-decoration: none|underline|overline|line-through|initial|inherit;

Property Values

Value Description Play it
none Defines a normal text. This is default Play it »
underline Defines a line below the text Play it »
overline Defines a line above the text Play it »
line-through Defines a line through the text Play it »
initial Sets this property to its default value. Read about initial Play it »
inherit Inherits this property from its parent element. Read about inherit

Related Pages

CSS tutorial: CSS Text

HTML DOM reference: textDecoration property




Search w3schools.com:

Translate w3schools.com: