Style textDecorationLineProperty

Style 对象参考手册Style Object

Examples

Display a line at the top of the paragraph:

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

Try it Yourself »

Definition and Usage

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

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

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


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

Almost all mainstream browsers do not support the textDecorationLine property.

Firefox supports an alternative property that can replace this one, namely 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"

Property Values

Value Description
none Default value. 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 in the middle of the text.
initial Sets this property to its default value. Seeinitial。
inherit Inherits this property from its parent element. Seeinherit。

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 对象参考手册Style Object

Other Extensions