Style textDecoration Property
Example
Set the text decoration for a <p> element:
document.getElementById("myP").style.textDecoration = "underline overline";
Try it yourself »
Definition and Usage
The textDecoration property sets or returns one ore more decorations for a text.
Tip: To specify more than one decoration type for an element, specify a space separated list of decoration types.
Browser Support
The textDecoration property is supported in all major browsers.
Syntax
Return the textDecoration property:
object.style.textDecoration
Set the textDecoration property:
object.style.textDecoration="none|underline|overline|line-through|blink|initial|inherit"
Property Values
Value | Description |
---|---|
none | Defines a normal text. This is default |
underline | Defines a line under the text |
overline | Defines a line over the text |
line-through | Defines a line through the text |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technical Details
Default Value: | none |
---|---|
Return Value: | A String, representing the decoration added to the text |
CSS Version | CSS1 |
More Examples
Example
Return the text decoration of a <p> element:
alert(document.getElementById("myP").style.textDecoration);
Try it yourself »
Related Pages
CSS tutorial: CSS Text
CSS reference: text-decoration property
Style Object