【发布时间】:2020-11-16 14:45:39
【问题描述】:
【问题讨论】:
-
@lucidbrot 这行不通,因为有问题的图像显示了不同长度的虚线:)
-
问题不在于边框...要获得与附加图像相同的结果,请使用 :after 和 :before 以及 position: absolute,并根据需要对齐它们。
【问题讨论】:
您可以在 hr 的顶部或底部设置 css 边框并应用破折号设置。
hr {
border-top: 4px dashed red;
<!DOCTYPE html>
<html>
<body>
<h1>Lorem ipsum</h1>
<hr>
</body>
</html>
或者使用多个hr的集合作为不同宽度的内联块。
.inlineHr {
display: inline-block;
border-top: 4px solid black;
}
.hr1 {
width:120px;
}
.hr2 {
width: 60px;
mergin-left: 10px;
}
.hr3 {
width: 20px;
mergin-left: 10px;
}
<!DOCTYPE html>
<html>
<body>
<h1>Lorem ipsum</h1>
<hr class='inlineHr hr1' />
<hr class='inlineHr hr2' />
<hr class='inlineHr hr3' />
<p>Here is the following text</p>
</body>
</html>
【讨论】: