CSS text-decoration-color Property

The text-decoration-color property sets the color of the text decoration. You can choose colors from here HTML colors.

Initial Value currentColor
Applies to All elements. It also applies to ::first-letter and ::first-line.
Inherited No.
Animatable Yes. The color is animatable.
Version CSS1, CSS3
DOM Syntax object.style.textDecorationColor = "#ccc";

Syntax

text-decoration-color: color | initial | inherit;

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the text</title>
    <style>
      p {
      text-decoration: overline underline;
      -webkit-text-decoration-color: #8ebf42; /* Safari */  
      text-decoration-color: #8ebf42;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-color property example</h2>
    <p>Lorem ipsum is simply dummy text...</p>
  </body>
</html>

In the given example the -webkit- extension for Safari is used.

Another example with the text-decoration-color property:

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      p { 
      text-decoration-line: underline;
      text-decoration-color: #666;
      text-decoration-style: wavy;
      }
      s {
      text-decoration-line: line-through;
      text-decoration-color: #c91010;
      }
    </style>
  </head>
  <body>
    <h2>Text-decoration-color property example</h2>
    <p>Lorem ipsum is <s>simply dummy</s> text...</p>
  </body>
</html>

Values

Value Description
color Defines the text decoration color. Color names, hexadecimal color codes, rgb(), rgba(), hsl(), hsla() can be used.
initial Sets the property to its default value.
inherit Inherits the property from its parent element.




Related articles