Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style textDecorationLine Property

Style textDecorationLine Property

Style Object Reference The Style object

Example

Display a line at the top of a paragraph:

document.getElementById("myP").style.textDecorationLine="overline";

Try it »


Definition and Usage

The textDecorationLine property sets or returns the type of line to be used for the text decoration.

**Note:** You can also use the textDecoration property to set textDecorationLine. The textDecoration property is a shorthand property for textDecorationLine, textDecorationStyle, and textDecorationColor.

**Note:** You can also use multiple values at the same time, such as underline and overline, to display lines both above and below the text.


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

Almost all major browsers do not support the textDecorationLine property.

Firefox supports an alternative property, the MozTextDecorationLine property.


Syntax

Return the textDecorationLine property:

object

.style.textDecorationLine

Set the textDecorationLine property:

object

.style.textDecorationLine="none|underline|overline|line-through|initial|inherit"

Attribute values

Value Description
none Default. Specifies that the text decoration has no line.
underline Specifies that a line will be displayed below the text.
overline Specifies that a line will be displayed above the text.
line-through Specifies that a line will be displayed through the middle of the text.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical Details

Default value: none
Return Value: A string representing the element's text-decoration-line property.
CSS version CSS3

Related Articles

CSS Reference Manual:text-decoration-line property


Style Object Reference The Style object