在 CSS 中设置文本装饰的颜色

cssweb developmentfront end technology更新于 2024/10/18 16:44:17

要设置文本装饰的颜色,请使用 text-decoration-color 属性 −

示例

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   text-decoration: overline;
   text-decoration-color: yellow;
}
</style>
</head>
<body>
<h1>Examination Details</h1>
<p class="demo">Exam on 20th December.</p>
<p class="demo2">Exam begins at 9AM.</p>
</body>
</html>

输出

示例

现在让我们看另一个例子 −

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   text-decoration: underline;
   text-decoration-color: orange;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near ABC College.</p>
<p class="demo2">Exam begins at 9AM.</p>
</body>
</html>

输出


相关文章


有用资源