Style textDecoration property
- 上一页 textAlignLast
- 下一页 textDecorationColor
- 返回上一层 Object na Style ng HTML DOM
Definition and Usage
textDecoration
Property sets or returns one or more decorations of text.
Tip:To specify multiple decoration types for an element, specify a list of decoration types separated by spaces.
See also:
CSS Tutorial:CSS 文本
CSS Reference Manual:text-decoration property
Example
Example 1
Set text decoration for the <p> element:
document.getElementById("myP").style.textDecoration = "underline overline";
Example 2
Return the text decoration of the <p> element:
alert(document.getElementById("myP").style.textDecoration);
Syntax
Return textDecoration property:
object.style.textDecoration
Set textDecoration property:
object.style.textDecoration = "none|underline|overline|line-through|blink|initial|inherit"
Attribute Value
Value | Description |
---|---|
none | Define normal text. Default. |
underline | Define the line under the text. |
overline | Define the line on the text. |
line-through | Define the line through the text. |
initial | Set this property to its default value. See also initial。 |
inherit | Inherit this property from its parent element. See also inherit。 |
Technical Details
Default Value: | None |
---|---|
Return Value: | String, representing the decoration added to the text. |
CSS Version: | CSS1 |
Browser Supports
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
支持 | 支持 | 支持 | 支持 | 支持 |
- 上一页 textAlignLast
- 下一页 textDecorationColor
- 返回上一层 Object na Style ng HTML DOM