CSS text-decoration-color Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Typography

What You’ll Learn

The text-decoration-color property controls the color of decoration lines on text, so underlines and strike-throughs can match or contrast with your design.

01

Line color

Decoration hue.

02

currentColor

Default match.

03

Named / hex

Color formats.

04

underline

Common use.

05

line-through

Sale prices.

06

Longhand

Part of family.

Introduction

The text-decoration-color property in CSS is used to set the color of text decorations such as underlines, overlines, and line-throughs. This allows you to customize the appearance of text decorations to match your design preferences, enhancing the visual appeal and readability of your web content.

Definition and Usage

Apply text-decoration-color on elements that already have a decoration line from text-decoration or text-decoration-line.

The decoration color can match the text with currentColor, or you can choose a different color for contrast, such as a red underline under dark text.

💡
Beginner Tip

If you do not see any color change, make sure the element has a decoration line such as text-decoration: underline; first.

📝 Syntax

The syntax for the text-decoration-color property is straightforward. It can be applied to any text element, and you can specify a color using any valid CSS color value:

syntax.css
element {
  text-decoration-color: color;
}

Here, color can be a named color, a hexadecimal value, an RGB value, an HSL value, or any other valid CSS color value.

Basic Example

red-underline.css
.underline {
  text-decoration: underline;
  text-decoration-color: red;
}

Syntax Rules

  • A decoration line must be present for the color to appear.
  • Any valid CSS color format works, including variables such as var(--brand).
  • currentColor makes the line match the element’s text color.
  • The property is not inherited, but shorthand on parent elements may affect children.

Related Properties

  • text-decoration — shorthand for line, style, color, and thickness
  • text-decoration-line — sets which lines appear
  • text-decoration-style — sets solid, dotted, dashed, or wavy lines
  • color — sets the text color itself

🎯 Default Value

The default value of the text-decoration-color property is currentColor, which means it inherits the color of the text itself.

⚡ Quick Reference

QuestionAnswer
Default valuecurrentColor
RequiresA decoration line from text-decoration or text-decoration-line
Accepted valuesAny CSS color, including currentColor
Common useColored underlines and strike-through lines
InheritedNo
AnimatableYes, as a color value

💎 Property Values

ValueExampleDescription
Named colortext-decoration-color: red;A color keyword such as blue, red, or green.
Hexadecimal valuetext-decoration-color: #ff5733;A hex code representing a color.
RGB valuetext-decoration-color: rgb(255, 87, 51);An RGB color value.
HSL valuetext-decoration-color: hsl(9, 100%, 60%);An HSL color value.
currentColortext-decoration-color: currentColor;Uses the current value of the color property.
red #2563eb green currentColor

When to Use text-decoration-color

text-decoration-color helps when the decoration line should look different from the text:

  • Branded links — Keep link text one color and the underline another.
  • Highlighted terms — Use a bright underline to draw attention without changing text color.
  • Sale prices — Style the strike-through line separately from the price text.
  • Design systems — Reuse CSS variables for consistent decoration colors across components.

👀 Live Preview

Decoration lines with different text-decoration-color values:

This text has a red underline.
This text has a blue underline.
This text has a green underline.
This text has a gray line-through.

Examples Gallery

Start with the reference red underline, then explore contrasting link colors, brand hex values, and styled sale prices.

📜 Colored Decoration Lines

Change the color of underlines and strike-through lines — matching the reference example.

Example 1 — Red underline

In this example, we’ll change the text decoration color of an underline to red.

index.html
<style>
  .underline {
    text-decoration: underline;
    text-decoration-color: red;
  }
</style>

<p class="underline">This text has a red underline.</p>
Try It Yourself

How It Works

The underline line appears because of text-decoration: underline, and text-decoration-color paints that line red.

Example 2 — Link text and underline in different colors

Set the text color and decoration color separately for a contrasting link style.

contrast-link.css
a {
  color: #1e40af;
  text-decoration: underline;
  text-decoration-color: #f59e0b;
}
Try It Yourself

How It Works

The text stays blue while the underline uses an amber color for extra visual contrast.

📄 Brand and UI Patterns

Use hex colors and strike-through styling for branded links and pricing UI.

Example 3 — Brand hex underline

Use a hex color to match your site palette on a highlighted term.

brand-underline.css
.highlight {
  text-decoration: underline wavy;
  text-decoration-color: #7c3aed;
}
Try It Yourself

How It Works

Combine wavy underline style with a brand purple decoration color for a playful emphasis effect.

Example 4 — Gray line-through on a sale price

Style the strike-through line separately from the price text color.

sale-strike.css
.old-price {
  color: #64748b;
  text-decoration: line-through;
  text-decoration-color: #94a3b8;
}
Try It Yourself

How It Works

text-decoration-color controls only the strike-through line, not the text fill color.

text-decoration-color in the family

text-decoration-color is one longhand piece of the text-decoration system. Pair it with text-decoration-line and text-decoration-style, or use the text-decoration shorthand when you want everything in one rule.

decoration-set.css
.note-link {
  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-color: #dc2626;
}

🧠 How text-decoration-color Works

1

A decoration line exists

The element has underline, overline, or line-through from text-decoration.

Line
2

You set decoration color

text-decoration-color chooses the paint color for that line independently from text color.

CSS rule
3

Browser renders the line

The decoration appears with your chosen color, style, and thickness settings.

Rendering
=

Styled decoration lines

Underlines and strike-throughs match your brand or create useful contrast.

Browser Compatibility

The text-decoration-color property is supported in most modern browsers, including current versions of Chrome, Firefox, Safari, Edge, and Opera. It is always a good practice to test your website across different browsers to ensure compatibility.

Modern browsers · Wide support

Reliable decoration color control

Chrome, Firefox, Safari, Edge, and Opera all support text-decoration-color in current versions.

96% Modern browser support
Google Chrome 57+ · Desktop & Mobile
Full support
Mozilla Firefox 36+ · Desktop & Mobile
Full support
Apple Safari 8+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 44+ · Modern versions
Full support

Testing tip

Verify colored wavy and dotted underlines in Safari and Firefox if your design relies on decorative link styling.

text-decoration-color property 96% supported

Bottom line: text-decoration-color is safe to use for styled links and text emphasis in modern projects.

Conclusion

The text-decoration-color property is a useful tool for web developers looking to enhance the visual appeal of their text content.

By customizing the color of text decorations, you can ensure that your text stands out and aligns with your overall design scheme. Experiment with different colors and see how this property can improve the look and feel of your web projects.

💡 Best Practices

✅ Do

  • Set a decoration line before applying text-decoration-color
  • Use brand colors or CSS variables for consistent underline styling
  • Contrast decoration color with text color when it improves clarity
  • Pair with text-decoration-style for dotted or wavy effects
  • Test colored underlines on links for accessibility and hover states

❌ Don’t

  • Expect color changes without an active decoration line
  • Assume decoration color always matches text color unless you set it
  • Use very low-contrast underline colors that are hard to see
  • Remove all link cues and rely on decoration color alone

Key Takeaways

Knowledge Unlocked

Five things to remember about text-decoration-color

Use these points when styling decoration lines on text.

5
Core concepts
02

Line required

Needs underline.

Rule
03

Any color

Hex, rgb, hsl.

Values
04

Separate control

Not text color.

Scope
🔄 05

text-decoration

Shorthand pair.

Companion

❓ Frequently Asked Questions

text-decoration-color sets the color of decoration lines such as underlines, overlines, and line-throughs on text.
The default value is currentColor, which means the decoration line uses the same color as the text.
Yes. A decoration line must exist before the color is visible. Set text-decoration or text-decoration-line such as underline or line-through.
Yes. You can set color on the text and text-decoration-color separately, for example blue text with a red underline.
Yes. Values like text-decoration: underline wavy red include the color, but text-decoration-color gives you separate control.

Practice in the Live Editor

Open the HTML editor and try text-decoration-color: red; with text-decoration: underline;.

HTML Editor →

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.

5 people found this page helpful