html - 在 CSS 中使两个圆圈位于垂直线的顶部

标签 html css

我想让线条顶部的橙色和蓝色圆圈介于两者之间。

.content-wrap {
  border-left: 1px dashed black;
  height: 5em;
  position: absolute;
}

.content-wrap::before {
  position: absolute;
  top: calc(50% - 1px);
  right: 0;
  left: 0;
  Content: "";
  border: none;
  height: 2px;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="content-wrap">
  <font-awesome-icon class="icon1" fixed-width icon="dot-circle" />
  <font-awesome-icon class="icon2" fixed-width icon="map-marker-alt" />
</div>

电流输出:
Refer to the above image
期望输出:
enter image description here

最佳答案

我之前没有使用过::效果。看看这是否有帮助。

.content-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: min-content;
  margin: 0 auto;
  padding: 2rem;
  border-radius: 0.25rem;
  background: #3e3e3e;
}

.circle {
  color: pink;
  font-size: 1.25rem;
}

.dotted {
  border-left: 0.125rem dashed #f0f0f0;
  height: 8rem;
}

.marker {
  color: lightblue;
  font-size: 1.25rem;
}
<script src="https://kit.fontawesome.com/a076d05399.js"></script>

<body>
  <div class="content-wrap">
    <i class="fas fa-dot-circle circle"></i>
    <div class="dotted"></div>
    <i class="fa fa-map-marker marker" aria-hidden="true"></i>
  </div>
</body>

关于html - 在 CSS 中使两个圆圈位于垂直线的顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63554046/

相关文章:

html - 了解相对和绝对定位 : how to align an internal div to the bottom of the container

php - 级联网格布局库

css - 子元素长于父元素

javascript - 如何从javascript中的spring Controller 类获取值?

html - 对齐响应式 div

javascript - 按下按钮时从数组中返回随机字符串

javascript - 带页面的框滚动

javascript - 添加带有html背景的透明图标

html - 如何在居中 Div 的左侧和右侧设置线条 - CSS

javascript - 有哪些方法可以使图像具有模糊效果?