Style textDecorationColor 属性
定义和用法
textDecorationColor 属性规定文本装饰的颜色(下划线、上划线、删除线)。
注意:textDecorationColor 属性仅对有可见文本装饰的元素有效。
实例
在带下划线的文本中更改线条的颜色:
document.getElementById("demo").style.textDecorationColor = "red";
语法
返回 textDecorationColor 属性:
object.style.textDecorationColor
设置 textDecorationColor 属性:
object.style.textDecorationColor = "color|initial|inherit"
属性值
| 值 | 描述 |
|---|---|
| color | 规定文本装饰的颜色。 |
| initial | 将此属性设置为其默认值。请参阅 initial。 |
| inherit | 从其父元素继承此属性。请参阅 inherit。 |
技术细节
| 默认值: | currentColor |
|---|---|
| 返回值: | 字符串,表示元素的 text-decoration-color 属性。 |
| CSS 版本: | CSS3 |
浏览器支持
表中的数字注明了首个完全支持该属性的浏览器版本。
| Chrome | Edge | Firefox | Safari | Opera |
|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Opera |
| 57 | 79.0 | 36.0 | 7.1 Webkit | 44.0 |