CSS text-decoration Property

Description

The text-decoration CSS property is used to control the visual decoration of text within an HTML element. It primarily defines how text should be styled in terms of underlines, overlines, line-throughs, or even blink effects. Common values for this property include "none" to remove any text decoration, "underline" to add an underline, "overline" to add a line above the text, and "line-through" to strike through the text. You can also combine multiple values to apply different decorations simultaneously. This property is frequently used to enhance the visual appearance of links, emphasizing their clickable nature, but it can be applied to any text content within an HTML document. Individual properties are: text-decoration-line, text-decoration-color, and text-decoration-style.

Initial value
none
Applies to
All elements
Inherited
No
Computed value
See individual properties
Animatable
See individual properties
JavaScript syntax
object.style.textDecoration

Interactive Demo

The rusty swing set creaked.

Syntax

text-decoration: <text-decoration-line> || <text-decoration-style> || <text-decoration-color>

Values

Example

<p class="test"> text-decoration: underline;  </p> 
<p class="test2"> text-decoration: overline; </p>
<p class="test3"> text-decoration: line-through; </p>
.test {
   text-decoration: underline;
   color: red; 
}
.test2 {
   text-decoration: overline;
   color: green;
}
.test3 {
   text-decoration: line-through;
   color: blue; 
}

Browser Support

The following table will show you the current browser support for the CSS text-decoration property.

Desktop
Edge Chrome Firefox Opera Safari
12113.51
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
18410.11137

Last updated by CSSPortal on: 2nd January 2024