html - css如何在中心圆旁边创建2条水平线?
问题描述
css如何在中心圆旁边创建2条水平线?
我想将相邻的盒子连接起来,它们的位置居中,我该怎么做?
#login {
display: flex;
text-align: left;
align-items: center;
justify-content: center;
flex-direction: row;
}
.elips {
width: 10rem;
height: 10rem;
background-color: red;
padding: red 2rem;
border-radius: 50%;
}
.box {
width: 5rem;
height: 2rem;
background-color: black;
}
<div id="login">
<div class="elips"></div>
<div><pre>-----
-----<pre>
</div>
<div class="box"></div>
解决方案
您可以使用dashed border style
中间 div。您无需为此使用文本。
#login {
display: flex;
text-align: left;
align-items: center;
justify-content: center;
flex-direction: row;
}
.elips {
width: 10rem;
height: 10rem;
background-color: red;
padding: red 2rem;
border-radius: 50%;
}
.box {
width: 5rem;
height: 2rem;
background-color: black;
}
.dashed-lines {
border: 2px dashed black;
width: 50px;
height: 5px;
border-left: transparent;
border-right: transparent;
}
<div id="login">
<div class="elips"></div>
<div class="dashed-lines"></div>
<div class="box"></div>
</div>
推荐阅读
- python - 如何从随机生成的列表中进行选择;?
- perl - 如何使用perl检查zip文件是否为空
- swiftui - 从按钮显示新视图按下 Swift UI
- javascript - 在javascript中使用reduce()通过多个键对数组的值进行分组
- ruby-on-rails - JSON 用于将多个记录传递到 POST 请求到 Rails API 创建操作?
- asp.net-mvc - HttpException:在控制器上找不到公共操作方法“ListCheckListType”
- machine-learning - 我怎样才能让 spacy 不产生 -PRON- lemma?
- ios - 有没有办法在 IOS 上使用 SVG 中的锚链接?
- python - Lambda 作为 Python 中的迭代器在第一次迭代时返回函数对象
- javascript - 无法在 reactJS App 中正确导入函数?