html - 如何使用 CSS 构建一条两边都有边框的虚线

标签 html css

我有 2 个圆圈,我在它们之间使用了 <hr/>对于虚线。

<td >
 <asp:Image ID="grrenimg" runat="server" ImageUrl="~/Images1/" />
 </td>
 <td>
   <hr class="dashed-lines" style=""/>
 </td>
 <td style="width: 2%">
 <asp:Image ID="redimg" runat="server" ImageUrl="~/Images2" />
 </td>

我需要这样的东西:

enter image description here

最佳答案

#Line {
  width: 100%;
  height: 1px;
  border-bottom: 2px dashed white;
  display: block;
}

#LineWrapper {
  background: gray;
  padding: 5px 0 5px 0;
   position: relative;
   top: 50px;
}

#LineWrapper::after {
    width: 30px;
    height: 30px;
    background: green;
    border: 2px solid gray;
    position: absolute;
    content: "";
    display: block;
    left: -6px;
    top: -10px;
    border-radius: 50%;
}

#LineWrapper::before {
    width: 30px;
    height: 30px;
    background: red;
    border: 2px solid gray;
    position: absolute;
    content: "";
    display: block;
    right: -6px;
    top: -10px;
    border-radius: 50%;
}
<div id="LineWrapper">
<span id="Line"></span>
</div>

关于html - 如何使用 CSS 构建一条两边都有边框的虚线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36036784/

相关文章:

javascript - 根据特殊选择的选择选项选择多选的相关选项

css - CSS 选择器中的/deep/and::shadow 是什么意思?

javascript - 在排行榜中包含滚动条

javascript - 使用 jQuery html 填充 div 时,内联 &lt;script&gt; block 焦点不会触发第二次

jquery - 另一个 Accordion 内的可折叠 Accordion

html - 两个 50% 宽度的 div 作为正方形

html - 垂直对齐不起作用按钮

javascript - 模态关闭/打开

css - 我可以设置 jQuery 的拆分按钮的宽度吗

css - LI 的均匀分布在 IE7 中不起作用