text-decoration用于设置文本装饰效果,如underline下划线、line-through删除线、overline上划线,支持颜色、样式、粗细等属性,可简写为text-decoration: line style color thickness,常用于去除链接下划线或标注价格删除线。

在CSS中,text-decoration 属性用于为文本添加装饰效果,比如下划线、上划线、删除线等。它是一个简写属性,可以分别设置线条的类型、颜色和样式位置。
示例:
.underline { text-decoration: underline; } .delete { text-decoration: line-through; } .top-line { text-decoration: overline; } .no-underline { text-decoration: none; }示例:
.wavy-red { text-decoration-line: underline; text-decoration-color: red; text-decoration-style: wavy; }.thick-blue {
text-decoration: underline blue;
text-decoration-thickness: 2px;
}
text-decoration: underline red wavy 2px;
立即学习“前端免费学习笔记(深入)”;
顺序不限,但推荐按 “line style color thickness” 的逻辑书写。
基本上就这些。text-decoration 简单实用,配合颜色和样式能让文本更有表现力。
以上就是在css中如何用text-decoration装饰文字的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号