Style textDecoration 屬性
- 上一頁 textAlignLast
- 下一頁 textDecorationColor
- 返回上一層 HTML DOM Style 對象
定義和用法
textDecoration
屬性設置或返回文本的一個或多個裝飾。
提示:如需為一個元素規定多個裝飾類型,請規定以空格分隔的裝飾類型列表。
另請參閱:
CSS 教程:CSS 文本
CSS 參考手冊:text-decoration 屬性
實例
例子 1
為 <p> 元素設置文本裝飾:
document.getElementById("myP").style.textDecoration = "underline overline";
例子 2
返回 <p> 元素的文本裝飾:
alert(document.getElementById("myP").style.textDecoration);
語法
返回 textDecoration 屬性:
object.style.textDecoration
設置 textDecoration 屬性:
object.style.textDecoration = "none|underline|overline|line-through|blink|initial|inherit"
屬性值
值 | 描述 |
---|---|
none | 定義普通文本。默認。 |
underline | 定義文本下的線條。 |
overline | 定義文本上的線條。 |
line-through | 定義穿過文本的線條。 |
initial | 將此屬性設置為其默認值。請參閱 initial。 |
inherit | 從其父元素繼承此屬性。請參閱 inherit。 |
技術細節
默認值: | 無 |
---|---|
返回值: | 字符串,表示添加到文本的裝飾。 |
CSS 版本: | CSS1 |
瀏覽器支持
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
支持 | 支持 | 支持 | 支持 | 支持 |
- 上一頁 textAlignLast
- 下一頁 textDecorationColor
- 返回上一層 HTML DOM Style 對象