Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Typography

The text-decoration-color property

Reference for the CSS text-decoration-color property: coloring underlines and strike-throughs separately from the text, currentcolor and live examples.

The text-decoration-color property sets the color of the underline, overline or line-through. By default the line has the same color as the text, but with this property you can give it an accent color, for example a colored underline under dark text. It has no effect when no decoration line is drawn.

CSS
a {
  text-decoration-line: underline;
  text-decoration-color: orange;
}

Try it

Colored underlines
Color change on hover

Syntax

CSS
text-decoration-color: <color>;
  • Initial value: currentcolor
  • Applies to: all elements; also ::first-letter and ::first-line
  • Inherited: no
  • Animatable: yes, as a color
  • Computed value: the computed color

Values

Value Description
currentcolor Follows the text color. This is the default.
<color> Any CSS color: names, hex, rgb(), hsl(), and so on. Transparent values make the line fainter or invisible.

Usage notes

  • A decoration needs a line. Set text-decoration-line (or the shorthand) first, otherwise the color is not visible.
  • Decoration color is taken from the declaring element. An inline child with a different color does not change the parent's line color; the parent's line is drawn with the parent's color or text-decoration-color.
  • Shorthand resets it. text-decoration: underline sets the color back to currentcolor.
  • Contrast. If the line carries meaning, such as a link underline, keep enough contrast against the background. A very pale underline can disappear.
  • Animation. You can transition the color for hover effects, as shown above.
  • Not a text color. It does not change the letters themselves.

Browser support

Supported in current versions of all major browsers.