Style textDecoration Property
Example
Set the text decoration for an element:
document.getElementById("demo").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
Property | |||||
---|---|---|---|---|---|
textDecoration | Yes | Yes | Yes | Yes | Yes |
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 an element:
alert(document.getElementById("demo").style.textDecoration);
Try it Yourself »
Related Pages
CSS tutorial: CSS Text
CSS reference: text-decoration property
❮ Style Object