在 CSS 中设置文本装饰样式
cssweb developmentfront end technology更新于 2024/11/2 18:52:17
要设置文本装饰样式,请使用 text-decoration-style 属性。您可以使用以下值 −
text-decoration-style: solid|double|dotted|dashed|wavy|initial|inherit;
示例
<!DOCTYPE html>
<html>
<head>
<style>
span {
text-decoration: line-through;
text-decoration-color: blue;
}
.demo2 {
text-decoration: underline;
text-decoration-style: double;
text-decoration-color: red;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near <span>XYZ College</span> ABC College.</p>
<p class="demo2">Exam begins at 11AM.</p>
</body>
</html>
输出

示例
现在让我们看另一个例子 −
<!DOCTYPE html>
<html>
<head>
<style>
.demo {
text-decoration: overline;
text-decoration-color: blue;
text-decoration-style: wavy;
}
.demo2 {
text-decoration: overline;
text-decoration-style: dashed;
text-decoration-color: red;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near ABC College.</p>
<p class="demo2">Exam begins at 11AM.</p>
</body>
</html>
输出

相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

