style.textDecoration (Property)

Controls decorative additions to the text such as underlines and strike-throughs.


CSS level - 1
DOM level - 2
JavaScript - 1.5
JScript - 3.0
Internet Explorer - 4.0
Netscape - 6.0
Property/method value type:String primitive
JavaScript syntax:-myStyle.textDecoration
CSS syntax:text-decoration: aStyle
Argument list:aStyleA set of decorative properties for the text

Text decoration is often confused with text style. In word processors you will commonly see italic and bold in the same menu as underline and strike-through. In the context of a web browser they are separated into fontStyle and text decoration.

The following decorations can be applied:

You can apply several of these decorations as long as they are space-separated in the string being assigned.

To restore text decoration to its default state simply assign an empty string, "". It is also likely that the value "none" will cancel the text decoration too, at least on the MSIE browser.

There are individual properties for each of these styles that you can use if you prefer. Those properties are controlled with a Boolean primitive value.

Setting the properties to the value true will add that decoration to the text block.

Setting the style.textDecorationNone property to true will automatically set the others to false and cancel the text decoration effect.

See also:JSSTag.textDecoration, String.blink(), String.strike(), style.textDecorationBlink, style.textDecorationLineThrough, style.textDecorationNone, style.textDecorationOverline, style.textDecorationUnderline