如何使用 CSS 创建不同的分隔线?
cssweb developmentfront end technology更新于 2025/12/16 12:28:17
使用 CSS 创建不同的分隔线,代码如下 −
示例
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<head>
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
.dashed {
border-top: 3px dashed rgb(216, 22, 22);
}
.dotted {
border-top: 3px dotted rgb(8, 11, 167);
}
.solid {
border-top: 3px solid rgb(18, 167, 38);
}
.rounded {
border-top: 8px solid rgb(200, 255, 0);
border-radius: 5px;
}
.double {
border-top: 3px double rgb(219, 46, 196);
}
</style>
</head>
<body>
<h1>Dividers Example</h1>
<p>Dashed</p>
<hr class="dashed" />
<p>Dotted</p>
<hr class="dotted" />
<p>Solid</p>
<hr class="solid" />
<p>Rounded</p>
<hr class="rounded" />
<p>Double</p>
<hr class="double" />
</body>
</html>
输出
上述代码将产生以下输出 −

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

