textDecorationColor Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:textDecorationColor

Description

The textDecorationColor property sets the color of the text-decoration.

Property Values

Value Description
color Sets the color of the text-decoration
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

Item Value
Default Value: currentColor
Return Value: A String, representing the text-decoration-color property of an element
CSS VersionCSS3

Change the color of the line, in an underlined text:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
p#myP {/*from   w w w  .jav a 2s . c  o  m*/
    text-decoration: underline;
}
</style>
</head>
<body>

<p id="myP">
Hello world!
</p>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {
    document.getElementById("myP").style.MozTextDecorationColor = "red"; // Code for Firefox
    document.getElementById("myP").style.textDecorationColor = "red";
}
</script>

</body>
</html>

Related Tutorials