Style textDecoration property

Definition and usage

textDecoration Property sets or returns one or more text decorations.

Tip:To specify multiple decoration types for an element, list the decoration types separated by spaces.

See also:

CSS Tutorial:CSS-Text

CSS Reference Manual:text-decoration property

Example

Example 1

Sets text decoration for the <p> element:

document.getElementById("myP").style.textDecoration = "underline overline";

Try it yourself

Example 2

Returns the text decoration of the <p> element:

alert(document.getElementById("myP").style.textDecoration);

Try it yourself

Syntax

Returns the textDecoration property:

object.style.textDecoration

Sets the textDecoration property:

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

Property value

Value Description
none Defines normal text. Default.
underline Defines a line under the text.
overline Defines a line on the text.
line-through Defines a line that passes 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 decoration added to the text.
CSS Version: CSS1

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Unterstützung Unterstützung Unterstützung Unterstützung Unterstützung