试图用CSS绘制虚线

Tel*_*men 0 html css draw css3 css-shapes

在此输入图像描述

我试图用CSS绘制它,我没有解决方案.谁能帮我这个?Ps:我搜索的东西很少,谢谢.

viv*_*yay 6

您可以在此处使用CSS pseudo元素绘制虚线:

.border {
  border-top: 1px dotted #000000;
  position: relative;
  margin: 100px 0 0 0;
  height: 4px;
}
.border::after {
  content: "";
  height: 1px;
  border-top: 1px dotted #000000;
  width: 100%;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}
.border::before {
  content: "";
  height: 1px;
  border-top: 1px dotted #000000;
  width: 100%;
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
}
Run Code Online (Sandbox Code Playgroud)
<div class="border">

</div>
Run Code Online (Sandbox Code Playgroud)