CSS text-decoration-color 属性
CSS text-decoration-color 属性用于设置文本修饰线的颜色,文本修饰线是通过 text-decoration-line 属性指定的。
修饰线包括下划线、上划线、删除线和波浪线,波浪线的典型用途是标明内容拼写错误(仅举例)。被指定的颜色会作用到该属性值有效范围内的所有修饰线上。
实例
把 text-decoration 的颜色设置为红色:
<!DOCTYPE html><html><head><style>p {text-decoration: underline;-webkit-text-decoration-color: red; /* Safari */text-decoration-color: red;}</style></head><body><h2>text-decoration-color 属性</h2><p>现在,下划线的颜色应该是红色!</p><p><b>注释:</b>版本 79 之前的 Edge 不支持 text-decoration-color 属性。</p></body></html>
定义和用法
text-decoration-color 属性规定 text-decoration(下划线、上划线、穿线)的颜色。
| 默认值: | currentColor |
|---|---|
| 继承: | 否 |
| 动画制作: | 支持。请参阅:动画相关属性。 |
| 版本: | CSS3 |
| JavaScript 语法: | object.style.textDecorationColor="red" |
浏览器支持
表格中的数字注明了完全支持该属性的首个浏览器版本。
带 -webkit- 或 -moz- 的数字表示使用前缀的首个版本。
| 属性 | |||||
|---|---|---|---|---|---|
| text-decoration-color | 57.0 | 79.0 | 36.06.0 -moz- | 7.1 -webkit- | 44.0 |
CSS 语法
text-decoration-color: color|initial|inherit;
属性值
| 值 | 描述 |
|---|---|
| color | 规定 text-decoration 的颜色。 |
| initial | 将此属性设置为其默认值。参阅 initial。 |
| inherit | 从其父元素继承此属性。参阅 inherit。 |
相关页面
CSS 教程:CSS 文本