中心响应式引导轮播

时间:2018-08-03 09:26:22

标签: html css twitter-bootstrap responsive-design

我正在尝试完全自定义引导轮播。我需要将其放在侧边栏,并且指示器位于底部(旋转木马之外)。到目前为止,我能够使它在大屏幕上运行,但是在较小的屏幕上,轮播拒绝居中居中。有没有办法使它居中(不使用边距)?预先感谢

当前结果: enter image description here 有问题的元素的HTML:

.other-articles {
  padding: 1.2rem;
}

.other-articles>h3 {
  font-size: .8rem;
}

.others {
  padding: 1.2rem;
  margin-top: 1.2rem;
  margin-bottom: 1.2rem;
}

.other-places {
  margin-top: 1.5rem;
}

.flex-other-articles {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

.item-other-articles {
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(162, 163, 163, 0.344);
  margin-top: .2rem;
}

.last-it-oth {
  border-bottom: none !important;
}

.item-other-articles img {
  border-radius: 3px;
  margin-top: -.7rem;
  height: 50px;
  width: 56px;
  flex-grow: 0;
  flex-shrink: 0;
}

.item-other-articles-txt {
  margin-left: .7rem;
}

.item-other-articles-txt>h6 {
  font-size: .7rem;
}

.item-other-articles-txt>p {
  font-size: .6rem;
}

@media (max-width:965px) and (min-width:780px) {
  .other-articles {
    text-align: center;
  }
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>


<div class="others block">
  <h6>OTHER PLACE</h6>
  <div class="other-place-dots">
    <i class="fas fa-circle"></i>
    <i class="fas fa-circle"></i>
    <i class="fas fa-circle"></i>
  </div>
  <div class="the-mini-slider-on-the-sidebar container-fluid">
    <div id="carouselExample" class="carousel slide" data-ride="carousel">
      <div class="carousel-inner mini-carousel-img">
        <div class="carousel-item">
          <img class="d-block w-100 " src="https://i.imgur.com/lCcKhji.jpg" alt="First slide">
          <div class="carousel-caption d-none d-md-block cap-1-black">
            <div class="carr-text-img">
              <h5>Ski Lifts</h5>
            </div>
          </div>
        </div>
        <div class="carousel-item">
          <img class="d-block w-100" src="https://i.imgur.com/lCcKhji.jpg" alt="Second slide">
          <div class="carousel-caption d-none d-md-block cap-1-black">
            <div class="carr-text-img">
              <h5>Ski Lifts</h5>
            </div>
          </div>
        </div>
        <div class="carousel-item active">
          <img class="d-block w-100" src="https://i.imgur.com/lCcKhji.jpg" alt="Third slide">
          <div class="carousel-caption d-none d-md-block cap-1-black">
            <div class="carr-text-img">
              <h5>Ski Lifts</h5>
            </div>
          </div>
        </div>
        <a class="carousel-control-prev" href="#carouselExample" role="button" data-slide="prev">
          <span class="carousel-control-prev-icon" aria-hidden="true"></span>
          <span class="sr-only">Previous</span>
        </a>
        <a class="carousel-control-next" href="#carouselExample" role="button" data-slide="next">
          <span class="carousel-control-next-icon" aria-hidden="true"></span>
          <span class="sr-only">Next</span>
        </a>
      </div>
      <div class="carousel slide carousel-in-li" data-ride="carousel">
        <ol class="carousel-indicators carousel-in-1">
          <li data-target="#carouselExample" data-slide-to="0" class=""></li>
          <li data-target="#carouselExample" data-slide-to="1" class=""></li>
          <li data-target="#carouselExample" data-slide-to="2" class="active"></li>
        </ol>
      </div>
    </div>
  </div>
</div>

0 个答案:

没有答案