使用 span 垂直创建三个点并对齐它们

creating three dots vertically with span and align them

我正在尝试创建三个垂直点并将容器的左下角与 css 和 bootstrap 对齐 5. 完全如下图所示:

我的 HTML 和 CSS:

.dot {
  border-radius: 50%;
  height: 12px;
  width: 12px;
  background: linear-gradient(90deg, #76b3fe, #8680e4);
}

.selected-dot {
  height: 20px;
  width: 20px;
  background: #97cdfe;
}
<section class="slider-bg-1 d-flex align-items-end">
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-lg-5 d-flex flex-column justify-content-center pt-4 pt-lg-0 order-2 order-lg-1">
        <h1 class="head-font-size">Choose a powerful design for your Start-up</h1>
        <h6 claas="caption-text-color">Get your freebie template now</h6>
        <div class="d-lg-flex">
          <div class="mt-5"><button class="my-btn" type="submit">Discover</button></div>
        </div>
      </div>
      <div class="col-lg-5 col-md-12 col-sm-12 order-1 order-lg-2 d-flex justify-content-center">
        <img src="Assets/home-slider/slider-m-1.png" class="img-fluid img-slider" alt="">
      </div>
    </div>
  </div>

  <span class="dot selected-dot"></span>
  <span class="dot"></span>
  <span class="dot"></span>
</section>

这是我的输出

如何垂直对齐并将它们移动到容器的左下角?因为当我使用 div 进行包装时,它们会消失

很简单,你可以像这样用div container包裹点

<!--Column Dots -->
<div class="dot-container">
  <span class="dot selected-dot"></span>
  <span class="dot"></span>
  <span class="dot"></span>
</div>

并按如下方式设置容器样式

.dot-container{
width: 15px;
display: flex;
flex-direction:column;
align-items:center;
}

以及更好的造型。给 dot class 一些像 margin: 3px 0;

这样的 amrgin

这是一个 codpen:https://codepen.io/shammlo/pen/QWKggNX?editors=1100

第 1 步:将点包裹在容器中。我使用了带有 class 的部分:.dot-wrapper。 第二:给包装器一个width: min-content;。有了它,它只会和选择的点一样宽。 第三:为了中心化点,给它们一个auto左右的边距;

.dot {
  border-radius: 50%;
  height: 12px;
  width: 12px;
  background: linear-gradient(90deg, #76b3fe, #8680e4);
  margin: 5px auto;
}

.selected-dot {
  height: 20px;
  width: 20px;
  background: #97cdfe;
}

.dot-wrapper {
  width: min-content;
}
<section class="slider-bg-1 d-flex align-items-end">
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-lg-5 d-flex flex-column justify-content-center pt-4 pt-lg-0 order-2 order-lg-1">
        <h1 class="head-font-size">Choose a powerful design for your Start-up</h1>
        <h6 claas="caption-text-color">Get your freebie template now</h6>
        <div class="d-lg-flex">
          <div class="mt-5"><button class="my-btn" type="submit">Discover</button></div>
        </div>
      </div>
      <div class="col-lg-5 col-md-12 col-sm-12 order-1 order-lg-2 d-flex justify-content-center">
        <img src="Assets/home-slider/slider-m-1.png" class="img-fluid img-slider" alt="">
      </div>
    </div>
  </div>

  <section class="dot-wrapper">
    <div class="dot selected-dot"></div>
    <div class="dot"></div>
    <div class="dot"></div>
  </section>
</section>