由于固定高度,Bootstrap Carousel不显示标题

时间:2018-01-17 23:25:00

标签: html css twitter-bootstrap

我的Bootstrap Carousel出了问题。它工作,显示图像,滑动,但如果我设置一个固定的高度它不会显示文本。我已经尝试过很多我可以在网上找到的解决方案,但是我的情况并非如此。

这是我的代码:



.carousel {
  max-height: 500px !important;
}

.carousel-inner {
  width: 100%;
}

.carousel-caption {
  background-color: transparent;
  max-width: 550px;
  padding: 0 20px;
  margin: 0 auto;
  margin-top: 200px;
  text-align: center;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
  <div class="carousel-inner" role="listbox" style=" width:100%; height: 500px !important;">
    <div class="carousel-item active">
      <img class="d-block w-100" src="http://www.dailydooh.com/wp-content/uploads/img/standard/300x250.gif" alt="First slide">
      <div class="carousel-caption d-none d-md-block">
        <h5>dgsdg</h5>
        <p>sdgsdgdsg</p>
      </div>
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="http://www.dailydooh.com/wp-content/uploads/img/standard/300x250.gif" alt="Second slide">
      <div class="carousel-caption d-none d-md-block">
        <h5>dgsdg</h5>
        <p>sdgsdgdsg</p>
      </div>
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="http://www.dailydooh.com/wp-content/uploads/img/standard/300x250.gif" alt="Third slide">
      <div class="carousel-caption d-none d-md-block">
        <h5>dgsdg</h5>
        <p>sdgsdgdsg</p>
      </div>
    </div>
  </div>
  <a class="carousel-control-prev" href="#carouselExampleControls" 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="#carouselExampleControls" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>
&#13;
&#13;
&#13;

我做错了什么?

0 个答案:

没有答案