Javascript examples for CSS Style Property:textDecorationLine
The textDecorationLine property sets or gets what type of line for the decoration.
Value | Description |
---|---|
none | Default value. Specifies no line for the text-decoration |
underline | Sets that a line will be displayed under the text |
overline | Sets that a line will be displayed over the text |
line-through | Sets that a line will be displayed through the text |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | none |
Return Value: | A String, representing the text-decoration-line property of an element |
CSS Version | CSS3 |
Display paragraphs with a line on top:
<!DOCTYPE html> <html> <head> <style> p#myP {/*from w w w . java 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.MozTextDecorationLine = "overline"; // Code for Firefox document.getElementById("myP").style.textDecorationLine = "overline"; } </script> </body> </html>