text-decoration-color

CSS text-decoration-color Property

The text-decoration-color property is used to set the color of the text decoration. You can choose colors from here HTML colors.

The colors can be applied to such decorations, as overlines, underlines, and wavy lines, in the scope of the value of this property.

The text-decoration-color property is one of the CSS3 properties.

类目类目
Initial ValuecurrentColor
Applies toAll elements. It also applies to ::first-letter and ::first-line.
InheritedNo.
AnimatableYes. The color is animatable.
VersionCSS1, CSS3
DOM Syntaxobject.style.textDecorationColor = “#ccc”;

Syntax

Syntax

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

Example of the text-decoration-color property:

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

Result

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

Example of the text-decoration-color property with the “underline” and “line-through” values:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      p {
        text-decoration-line: underline;
        text-decoration-color: #666666;
        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

Values

ValueDescriptionPlay it
colorDefines the text decoration color. Color names, hexadecimal color codes, rgb(), rgba(), hsl(), hsla() can be used.Play it »
initialSets the property to its default value.Play it »
inheritInherits the property from its parent element.


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部