Latest web development tutorials

HTML DOM Style textDecorationLine property

Style Object Reference Style Objects

Examples

At the top of the paragraph a line appears:

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

try it"

Definition and Usage

textDecorationLine property sets or returns modified text line type to use.

Note: You can also use textDecoration property set textDecorationLine. textDecoration property is textDecorationLine, textDecorationStyle and textDecorationColor properties shorthand property.

Note: You can also use multiple values simultaneously, such as underline and overline, to show the lines above and below the text.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Almost all of the major browsers do not support textDecorationLine property.

Firefox supports another alternative of the property attribute that MozTextDecorationLine property.


grammar

Back textDecorationLine properties:

object .style.textDecorationLine

Setting textDecorationLine properties:

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

Property Value

描述
none 默认值。规定文本修饰没有线条。
underline 规定文本的下方将显示一条线。
overline 规定文本的上方将显示一条线。
line-through 规定文本的中间将显示一条线。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: none
return value: String representing the text-decoration-line attributes of the element.
CSS version CSS3


related articles

CSS Reference: text-Decoration-Line Properties


Style Object Reference Style Objects