textDecorationStyle Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:textDecorationStyle

Description

The textDecorationStyle property sets or gets the style for text decoration line.

Property Values

Value Description
solid Default value. The line will display as a single line
double a double line
dotted a dotted line
dashed a dashed line
wavya wavy line
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

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

Display a wavy line under the paragraph:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
p#myP {//www  .ja  va2s.co 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.MozTextDecorationStyle = "dotted"; // Code for Firefox
    document.getElementById("myP").style.textDecorationStyle = "dotted";
}
</script>

</body>
</html>

Related Tutorials