Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

text-decoration-color — text decoration line color

The text-decoration-color property sets the color of underlines, overlines, and strike-throughs independently of the letters. It does not enable any line by itself.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

text-decoration-color: <color>;

text-decoration-color accepts a <color> value, such as #c00000. It colors the lines specified by text-decoration-line, not the letters. Its initial value, currentcolor, uses the color specified by color.

The property is not inherited. However, a decoration originating on an ancestor can run through a descendant’s text: setting a different text-decoration-color on the descendant does not recolor that line. All lines originating on one element share a color.

The text-decoration shorthand also sets this color; omitting it from the shorthand restores the initial value. To avoid accidental resets, place a separate color declaration after the shorthand. For spelling-error and grammar-error decorations, the browser ignores this color.

Examples

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Decoration color</title>
<style>
  .sample {
    color: #222222;
    text-decoration-line: underline;
    text-decoration-style: solid;
    text-decoration-color: #c00000;
  }
</style>
<p class="sample">Separate underline color</p>
</html>

Result

Separate underline color

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources