CSS text-decoration 的作用
CSS 的 text-decoration 属性用于为文本添加装饰效果,如下划线、删除线和上划线。
功能:
text-decoration 属性可以指定以下四种装饰效果:
- underline:在文本下方添加一条线。
- overline:在文本上方添加一条线。
- line-through:在文本中间添加一条线。
- none:移除所有文本装饰。
语法:
text-decoration 属性的语法如下:
text-decoration: none|underline|overline|line-through|initial|inherit;
用法:
要为元素的文本添加装饰,可以使用 text-decoration 属性,如下所示:
p { text-decoration: underline;}
以上代码将为段落
中的文本添加下划线。
示例:
以下是使用不同 text-decoration 值创建文本装饰效果的一些示例:
- 下划线:
带下划线的文本
- 删除线:
带删除线的文本
- 上划线:
带上划线的文本
- 无装饰:
无文本装饰
兼容性:
text-decoration 属性在所有现代浏览器中都得到广泛支持。
以上就是CSS text-decoration的作用的详细内容,更多请关注css网站其它相关文章!