text-decoration
text-decoration 属性定义文本是否带有下划线、上划线和/或删除线。它是 text-decoration-line 和 text-decoration-style 属性的简写。
文本装饰的填充和描边由声明文本装饰时的文本的填充和描边给出。
文本装饰的绘制顺序(即填充和描边)由声明文本装饰时的 paint-order 属性的值决定。
注意: 作为表示属性,text-decoration 还有一个对应的 CSS 属性:text-decoration。当两者都被指定时,CSS 属性具有优先权。
你可以将此属性与以下 SVG 元素一起使用
示例
html
<svg viewBox="0 0 250 50" xmlns="http://www.w3.org/2000/svg">
<text y="20" text-decoration="underline">Underlined text</text>
<text x="0" y="40" text-decoration="line-through">Struck-through text</text>
</svg>
用法说明
| 值 |
<'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> |
|---|---|
| 默认值 | 查看单独的属性 |
| 可动画的 | 是 |
有关值的描述,请参阅 CSS text-decoration 属性。
规范
| 规范 |
|---|
| CSS 文本装饰模块级别 3 # text-decoration-property |
| Scalable Vector Graphics (SVG) 2 # TextDecorationProperties |
浏览器兼容性
加载中…
另见
- CSS
text-decoration属性