CSS font-variant 属性
cssweb developmentfront end technology更新于 2024/11/5 19:56:17
CSS 中的 font-variant 属性是以下属性的简写:font-variant-caps、font-variant-numeric、font-variant-alternates、font-variant-ligatures 和 font-variant-east-asian。其值为 −
font-variant: normal|small-caps|initial|inherit;
示例
现在让我们看一个实现 font-variant 属性的示例 −
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image: linear-gradient(to right, yellow,orange,yellow,green,blue,indigo,violet);
}
.demo {
text-decoration: overline;
text-decoration-color: yellow;
font-variant:normal;
}
</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: overline underline;
text-decoration-color: blue;
font-variant: small-caps;
}
</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>
输出

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

