HTML轮播使用静态图像上的文本

时间:2017-09-15 22:21:50

标签: html twitter-bootstrap carousel

(新的) 我试图通过顶部的不同文本的旋转木马来获取静态图像。我尝试过使用Bootstrap轮播HTML并删除部分(例如多个图像),并使用"轮播字幕"我的文字的课程,但这将需要一些样式,以使其居中等。这可能是最好的方式,但如果有一个更简单的方法,请告诉我! (它在jumbotron div中,因为我使用了我的jumbotron部分的图片以方便) TIA

<div class="jumbotron" id="testimonials">
      <div class="container">
          <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner" role="listbox">
    <div class="item active">
    <div class="carousel-text">
        <h3>Example headline</h3>
        <p>Example description</p>
      </div>
      <!-- <img src="img/lesson8-portfolioheroimage2.jpg" alt="..."> -->

    </div>
    <div class="item">
      <!-- <img src="img/portfolioheroimage.jpg" alt="..."> -->
      <div class="carousel-text">
        <h3>Example head</h3>
        <p>Example description</p>
      </div>
    </div>
    <div class="item">
      <!-- <img src="img/portfolioheroimage3.jpg" alt="..."> -->
      <div class="carousel-text">
        <h3>Example headline</h3>
        <p>Example descri</p>
      </div>
    </div>
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>


      </div><!-- container -->
    </div><!-- jumbotron -->

1 个答案:

答案 0 :(得分:0)

&#13;
&#13;
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="jumbotron">
  <div class="container">

    <div id="myCarousel" class="carousel slide" data-ride="carousel">
      <!-- Indicators -->
      <ol class="carousel-indicators">
        <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
        <li data-target="#myCarousel" data-slide-to="1"></li>
        <li data-target="#myCarousel" data-slide-to="2"></li>
      </ol>

      <!-- Wrapper for slides -->
      <div class="carousel-inner">
        <div class="item active">
          <div class="carousel-text">
            <h3>Example headline</h3>
            <p>Example description</p>
          </div>
          <!-- <img src="img/lesson8-portfolioheroimage2.jpg" alt="..."> -->

        </div>
        <div class="item">
          <!-- <img src="img/portfolioheroimage.jpg" alt="..."> -->
          <div class="carousel-text">
            <h3>Example head</h3>
            <p>Example description</p>
          </div>
        </div>
        <div class="item">
          <!-- <img src="img/portfolioheroimage3.jpg" alt="..."> -->
          <div class="carousel-text">
            <h3>Example headline</h3>
            <p>Example descri</p>
          </div>
        </div>
      </div>

      <!-- Left and right controls -->
      <a class="left carousel-control" href="#myCarousel" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left"></span>
        <span class="sr-only">Previous</span>
      </a>
      <a class="right carousel-control" href="#myCarousel" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right"></span>
        <span class="sr-only">Next</span>
      </a>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;

我猜你需要这样的东西吗? 你可以根据自己的要求美化它。