CSS text-decoration-line 属性

实例

设置不同的 text-decoration 线条类型:

div.a {
  text-decoration-line: overline;
}

div.b {
  text-decoration-line: underline;
}

div.c {
  text-decoration-line: line-through;
}

div.d {
  text-decoration-line: overline underline;
}

亲自试一试

定义和用法

text-decoration-line 属性设置要使用哪种文本装饰的类型(下划线、上划线、穿线)。

提示:同时请参阅 text-decoration 属性,它是 text-decoration-line、text-decoration-style 以及 text-decoration-color 的简写属性。

注释:您还可以组合多个值,比如 underline 和 overline,在文本上下方同时显示线条。

默认值: none
继承:
动画制作: 不支持。请参阅:动画相关属性
版本: CSS3
JavaScript 语法: object.style.textDecorationLine="overline"

浏览器支持

表格中的数字注明了完全支持该属性的首个浏览器版本。

带 -webkit- 或 -moz- 的数字表示使用前缀的首个版本。

属性 Chrome IE Firefox Safari Opera
text-decoration-line 57.0 79.0 36.0
6.0 -moz-
7.1 -webkit- 44.0

CSS 语法

text-decoration-line: none|underline|overline|line-through|initial|inherit;

属性值

描述
none 默认值。规定 text-decoration 没有线条。
underline 规定在文本下方显示线条。
overline 规定在文本上方显示线条。
line-through 规定显示横穿文本的线条。
initial 将此属性设置为其默认值。参阅 initial
inherit 从其父元素继承此属性。参阅 inherit

相关页面

CSS 教程:CSS 文本

HTML DOM 参考手册:textDecorationLine 属性