手册
目录
收藏843
分享
阅读1027
更新时间2025-07-16
text-decoration 属性规定添加到文本的修饰。
注释:修饰的颜色由 "color" 属性设置。
这个属性允许对文本设置某种效果,如加下划线。如果后代元素没有自己的装饰,祖先元素上设置的装饰会“延伸”到后代元素中。不要求用户代理支持 blink。
CSS 教程:CSS 文本
HTML DOM 参考手册:textDecoration 属性
设置 h1、h2、h3、h4 元素的文本修饰:
h1 {text-decoration:overline;}
h2 {text-decoration:line-through;}
h3 {text-decoration:underline;}
h4 {text-decoration:blink;}
运行实例 »点击 "运行实例" 按钮查看在线实例
text-decoration: text-decoration-line text-decoration-color text-decoration-style text-decoration-thickness|initial|inherit;
| 值 | 描述 |
|---|---|
| text-decoration-line | 设置要使用的文本装饰类型(如下划线、上划线、划线)。 |
| text-decoration-color | 设置文字装饰的颜色。 |
| text-decoration-style | 设置文本装饰的样式(如实心、波浪形、点线、虚线、双线)。 |
| text-decoration-thickness | 设置装饰线的粗细。 |
| initial | 将此属性设置为其默认值。请参阅 initial。 |
| inherit | 从其父元素继承此属性。请参阅 inherit。 |
| 默认值: | none |
|---|---|
| 继承性: | no |
| 版本: | CSS1 |
| JavaScript 语法: | object.style.textDecoration="overline" |
表格中的数字注明了完全支持该属性的首个浏览器版本。
| Chrome | IE / Edge | Firefox | Safari | Opera |
|---|---|---|---|---|
| 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
相关
视频
RELATED VIDEOS
科技资讯
1
2
3
4
5
6
7
8
9
精选课程
共5课时
17.2万人学习
共49课时
77万人学习
共29课时
61.7万人学习
共25课时
39.3万人学习
共43课时
70.9万人学习
共25课时
61.6万人学习
共22课时
23万人学习
共28课时
33.9万人学习
共89课时
125万人学习