Style textDecorationLine Property

Definition and Usage

textDecorationLine Sets or returns the line type to be obtained by the decoration (if any).

Note:You can also use the textDecoration property to set textDecorationLineis a shorthand property for the following properties:

Note:You can also combine multiple values, such as underline and overlineto display lines both below and above the text.

See also:

CSS Reference Manual:text-decoration-line property

Example

Display a paragraph with a line at the top:

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

Try it yourself

Syntax

Return textDecorationLine Property:

object.style.textDecorationLine

Set textDecorationLine Property:

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

Property Value

Value Description
none Default value. Specifies that there is no text decoration line.
underline Specifies that a line will be displayed below the text.
overline Specifies that a line will be displayed over the text.
line-through Specifies that a line will be displayed through 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 that represents the element's text-decoration-line property.
CSS Version: CSS3

Browser Support

The numbers in the table indicate the first browser version to fully support this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
57.0 79.0 36.0 7.0 Webkit 44.0