CSS text-decoration-color Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The text-decoration-color property sets the color of decoration lines drawn by text-decoration-line—underlines, overlines, and line-throughs. It does not change the text (glyph) color.

The initial value is currentColor, so the line matches the text until you override it. You can also set color inside the text-decoration shorthand.

Standard-track.

Baseline widely available. Not deprecated, experimental, or non-standard.

Accessibility contrast

Keep enough contrast between the line, the text, and the background. Do not rely on decoration color alone to show focus or meaning.

CSS Syntax

syntax.css
text-decoration-color: <color> | initial | inherit;

Any valid CSS <color> works: names, hex, rgb(), hsl(), currentColor, or transparent.

Property Values

ValueDescriptionTry it
redNamed color for the decoration lineTry it
currentColorMatches the element’s text color (initial)Try it
#dc2626Hex color; often used when text uses another colorTry it
rgb(29 78 216 / 0.7)RGB with alpha for a softer lineTry it
initialResets to currentColorTry it
inheritTakes the parent’s text-decoration-colorTry it

How to Use text-decoration-color

Draw a line first, then color it. The color alone never creates a decoration.

  1. Set a line with text-decoration-line or the text-decoration shorthand.
  2. Add text-decoration-color with any <color>.
  3. Keep glyph color separate with the color property when you want a split look.
  4. Check contrast so the line stays readable on the background.
PieceRequired?Role
Decoration lineYesunderline, overline, or line-through
text-decoration-colorNoDefaults to currentColor
colorNoGlyph color; independent of the line

Live Preview

Same underlined sentence. Change only text-decoration-color.

The sample stays underlined. Only the line color changes.

Text

Sample decoration color

text-decoration-color: red

CSS Examples

Each snippet focuses on text-decoration-color. Use Try It Yourself for a live editor.

Example 1 — Color an Underline

Underline the text, then paint the line red.

CSS
<style>
  p {
    text-decoration-line: underline;
    text-decoration-color: red;
  }
</style>

<p>Sample decoration color</p>
Try It Yourself

How It Works

  1. Draw a line. text-decoration-line: underline creates the decoration.
  2. Color the line. text-decoration-color: red paints that line only.
  3. Text stays default. Glyph color is unchanged unless you set color.
  4. Shorthand option. text-decoration: underline red can do both in one rule.

Example 2 — Text and Line Colors Differ

Keep blue text and a red underline.

CSS
<style>
  p {
    color: #1d4ed8;
    text-decoration-line: underline;
    text-decoration-color: #dc2626;
  }
</style>

<p>Sample decoration color</p>
Try It Yourself

How It Works

  1. Set glyph color. color controls the letters.
  2. Keep the underline. text-decoration-line: underline is still required.
  3. Override the line. text-decoration-color breaks away from currentColor.
  4. Why it matters. Links and highlights can use a quieter or louder line than the text.

Example 3 — Match Text with currentColor

Let the decoration follow the text color (the initial behavior).

CSS
<style>
  p {
    color: #1d4ed8;
    text-decoration-line: underline;
    text-decoration-color: currentColor;
  }
</style>

<p>Sample decoration color</p>
Try It Yourself

How It Works

  1. Pick a text color. Here color: #1d4ed8 sets the glyphs.
  2. Add a line. Without a line, color has nothing to paint.
  3. Use currentColor. The line resolves to the same computed color as the text.
  4. Reset tip. initial also returns to currentColor.

Edge Cases & Pitfalls

If the line color looks wrong, one of these is usually why.

line

No line means no visible color

text-decoration-color only paints decorations from text-decoration-line. With none, the color has no effect.

shorthand

Shorthand can wipe a custom color

Setting text-decoration: underline later resets color to currentColor. Prefer the longhand when you only want to toggle the line.

multi

One color for all lines on the element

You cannot give underline and line-through different colors on the same element. Nest spans and color each line separately.

inherit

Not inherited by default

The property’s inherited flag is no. Use the inherit keyword when a child must take the parent’s decoration color.

a11y

Color is not enough for meaning

Do not signal focus, errors, or links with decoration color alone. Pair with weight, style, or other cues, and keep contrast high.

Browser Support

text-decoration-color is a browser CSS property for decoration line color. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available since Jan 2020

text-decoration-color

Supported in Chrome 57+, Firefox 36+, Safari 12.1+, Edge 79+, Opera 44+, Samsung Internet 7+. Not supported in Internet Explorer.

97% Global support
Google Chrome 57+
Full support
Mozilla Firefox 36+
Full support
Apple Safari 12.1+
Full support
Microsoft Edge 79+
Full support
Opera 44+
Full support
Samsung Internet 7+
Full support
Internet Explorer No
Not supported
text-decoration-color Widely supported

Bottom line: Safe for modern browsers. IE ignores the property and keeps the decoration at the text color.

Key Takeaways

  • Role: colors decoration lines without changing glyph color.
  • Initial value: currentColor. Not inherited.
  • Prerequisite: a visible text-decoration-line must exist.
  • Pitfall: shorthand text-decoration can reset your custom color.

One line: draw the decoration first, then set text-decoration-color when the line should differ from the text.

Frequently Asked Questions

It sets the color of decoration lines drawn by text-decoration-line, such as underlines, overlines, and line-throughs.
currentColor. The decoration matches the element’s text color unless you override it.
A decoration line must exist first. Set text-decoration-line (or the text-decoration shorthand) to underline, overline, or line-through.
Yes. Set color for the glyphs and text-decoration-color for the line. They are independent.
Not with one property. Nest elements, give each a different text-decoration-line, and set text-decoration-color on each.
Baseline widely available: Chrome 57+, Firefox 36+, Safari 12.1+, Edge 79+. Internet Explorer does not support it. It is a browser CSS property, not a Node.js feature.

Next: text-decoration-line

Learn which decoration lines you can draw before coloring them.

text-decoration-line tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful