CSS Reference Property

text-decoration-color 726a2b

This property specifies the color of text decoration (underlines, overlines and line-throughs) set on the element with text-decoration-line. 2o5m6n

The default value for the text-decoration-color property is currentColor, which, as the name suggests, sets the color of the text decoration to the current color applied to the text using the color property, which could be inherited if no specific value is set.

Official Syntax 4j1l4a

  • Syntax:

    text-decoration-color: <color>
  • Initial: currentColor
  • Applies To: all elements
  • Animatable: yes, as a <color>

Values 4w6m73

<color>
The color value accepts various keywords and numeric notations. See <color> values for more details.

Examples 3y6d6i

The following snippet sets an underline decoration (using the text-decoration-line property) on all h1 elements in a page and colors the underline red.

h1 {
  text-decoration-line: underline;
  text-decoration-color: red;
}
                

Other examples:

p {
  text-decoration-color: #eee;
}

.overlined-text {
  text-decoration-line: overline;
  text-decoration-color: rgba(0,0,0,0.25);
}
                

Browser s162l

The property is currently only ed in Firefox 6+, and it needs the -moz- prefix.

Further Reading g1037

Written by

Last updated June 4, 2020 at 4:11 pm by Mary Lou

Do you have a suggestion, question or want to contribute? Submit an issue.