text-decoration-line 属性用于设置文本装饰线的类型,常用于下划线、删除线等效果。
值
none:默认值,没有任何装饰线。underline:文本下方显示一条下划线。overline:文本上方显示一条上划线。line-through:文本中间显示一条删除线。blink:文本闪烁效果(不建议使用,已被大多数浏览器禁用)。
语法
p {
text-decoration-line: underline;
}示例
// www.javascriptcn.com code example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text Decoration Example</title>
<style>
.underline {
text-decoration-line: underline;
}
.overline {
text-decoration-line: overline;
}
.line-through {
text-decoration-line: line-through;
}
</style>
</head>
<body>
<p class="underline">This text has an underline.</p>
<p class="overline">This text has an overline.</p>
<p class="line-through">This text has a line-through.</p>
</body>
</html>以上是关于 text-decoration-line 属性的详细介绍,通过设置不同的值可以实现不同的文本装饰效果。