Style textDecorationColorProperty
Examples
Change the color of the underline in underlined text:
document.getElementById("myP").style.textDecorationColor="red";
Try it Yourself »
Definition and Usage
The textDecorationColor property specifies the color of the text decoration (underline, overline, line-through).
Note:The textDecorationColor property only takes effect on elements that have a visible text-decoration.
Browser Support
![]()
Almost all mainstream browsers do not support the textDecorationColor property.
Firefox supports an alternative property, namely the MozTextDecorationColor property.
Syntax
Return the textDecorationColor property:
object.style.textDecorationColor
Set the textDecorationColor property:
object.style.textDecorationColor="color|initial|inherit"
Property Values
| Value | Description |
|---|---|
| color | Specifies the color of the text decoration. |
| initial | Sets this property to its default value. Seeinitial。 |
| inherit | Inherits this property from its parent element. Seeinherit。 |
Technical Details
| Default value: | currentColor |
|---|---|
| Return value: | A string, representing the element's text-decoration-color property. |
| CSS Version | CSS3 |
Related Articles
CSS Reference Manual:text-decoration-color property
Other Extensions
Style Object