在Bootstrap中的滑块库中的图像上的文本框

时间:2017-07-21 14:18:57

标签: twitter-bootstrap twitter-bootstrap-3 slider

我制作了一个滑块,但我想在每张图片上都有文字。 图像中间应该有一个透明的白色文本框,其中有一个文本。我似乎无法找到解决方案。

1 个答案:

答案 0 :(得分:0)

如果您正在寻找bootstrap carousel,那么这应该有帮助

<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="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">
        <img src="http://static3.businessinsider.com/image/5783556cdd0895a96d8b47b9-480/pikachu-pokemon-nintendo.jpg" alt="Los Angeles" style="width:100%;">
        <div class="carousel-caption">
          <h3>Pokemon</h3>
          <p>PokemonPokemonPokemon</p>
        </div>
      </div>

      <div class="item">
        <img src="https://i.ytimg.com/vi/caxndn8emf4/maxresdefault.jpg" alt="Chicago" style="width:100%;">
        <div class="carousel-caption">
          <h3>PokemonPokemon</h3>
          <p>PokemonPokemonPokemonPokemon</p>
        </div>
      </div>

      <div class="item">
        <img src="https://www.serebii.net/ultrasunultramoon/ichooseyoucappikachu.jpg" alt="New York" style="width:100%;">
        <div class="carousel-caption">
          <h3>PokemonPokemonPokemon</h3>
          <p>PokemonPokemonPokemonPokemonPokemon</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>