在bootstrap轮播中并排堆叠两个图像

时间:2016-04-29 07:10:46

标签: jquery css twitter-bootstrap

我正在尝试做两件事:

1)在自举旋转木马上并排堆叠两张图像

2)我想在桌面视图中并排显示2张图片,在移动视图中只显示一张图片。

这是我的bootply: http://www.bootply.com/6UtgjHqm8f

我添加了

List data = ......;
JavaRDD rdd = sc.parallelize(data);

这有帮助,但我的对齐关闭了。第一张图片向左移动并挤满左侧导航。

这是我的HTML:

.carousel-inner .item img {
  display: inline-block;
}

这是我的CSS:

   <div class="content-section-b">

    <div class="container">

        <div class="row">
            <div class="col-lg-12">
                <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>
                  </ol>

                  <!-- Wrapper for slides -->
                  <div class="carousel-inner" role="listbox">
                    <div class="item active">
                      <img class="img-responsive" src="http://www.onvia.com/responsive/apples_01.png" alt="Apples">
                      <img class="img-responsive" src="http://www.onvia.com/responsive/oranges_01.png" alt="Oranges">
                    </div>
                    <div class="item">
                      <img class="img-responsive" src="http://www.onvia.com/responsive/pears_01.png" alt="Pears">
                      <img class="img-responsive" src="http://www.onvia.com/responsive/mangos_01.png" alt="Mangos">
                    </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>
        </div>

    </div>
    <!-- /.container -->

</div>
<!-- /.content-section-b -->

1 个答案:

答案 0 :(得分:2)

问题在于img标签上的图像css属性使用inline-block并且每件事都没问题

bootply Demo