CSS 中的文本装饰

cssweb developmentfront end technology更新于 2024/11/20 4:28:17

对于 CSS 中的文本装饰,请使用 text-decoration 属性作为以下属性的简写属性 −

text-decoration-line
text-decoration-color
text-decoration-style

示例

让我们看一个 CSS 中的文本装饰示例 −

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   text-decoration: overline underline;
}
</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>

输出

示例

现在让我们看另一个例子,其中我们使用单独的值 −

<!DOCTYPE html>
<html>
<head>
<style>
p {
   writing-mode: vertical-rl;
   text-decoration-line: overline;
   text-decoration-color: red;
   text-decoration-style: wavy;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<p>This is demo text.</p>
</body>
</html>

输出


相关文章


有用资源