Bootstrap轮播照片列表不起作用

时间:2018-03-03 08:15:07

标签: css twitter-bootstrap bootstrap-4 bootstrap-carousel

我正在尝试添加一个引导程序轮播到我正在为某人制作的网站,每次添加照片或标题时,这些照片都会排列在列表中,并且标题会叠加在顶部彼此的。有人可以帮忙吗?

这就是网站的样子:

相互堆叠的照片:

enter image description here

使用<h3><h4>字符串的标题是什么:

enter image description here

这是一些代码(我使用了bootstrap在他们网站上的模板):

<section class="container">
      <div class="row">
        <div class="col-sm-12">
          <div id="my-slider" class="carousel slide col-sm-12" data-ride="carousel">
            <!-- indicators -->
            <ol class="carousel-indicators">
              <li data-target="#my-slide" data-slide-to="0" class="active"></li>
              <li data-target="#my-slide" data-slide-to="1"></li>
              <li data-target="#my-slide" data-slide-to="2"></li>
              <li data-target="#my-slide" data-slide-to="3"></li>
            </ol>
            <!-- wrappers -->
            <div class="carousel-inner" role="listbox">
              <div class="item active">
                <img src="" alt=""/>
                <div class="carousel-caption">
                    <h3>Flutes of the World Concert</h3>
                    <h5>with Tereasa Payne</h5>
                </div>
              </div>
              <div class="item">
                  <img id="img" src="img/RPO_Siku.jpg" alt="siku"/>
                  <div class="carousel-caption">
                    <h4></h4>
                    <h5></h5>
                  </div>
                </div>
                <div class="item">
                  <img id="img" src="img/RPO_Nose_Flute_Laughing.jpg" alt=""/>
                  <div class="carousel-caption">
                    <h4></h4>
                    <h5></h5>
                  </div>
                </div>
                <div class="item">
                  <img id="img" src="img/RPO_playing_Toyo.jpg" alt=""/>
                  <div class="carousel-caption">
                    <h4></h4>
                    <h5></h5>
                  </div>
                </div>
                <div class="item">
                    <img src="img/RPO_Native_American_Flute.jpg" alt=""/>
                    <div class="carousel-caption">
                      <h4></h4>
                      <h5></h5>
                    </div>
                  </div>
            </div>
            <!-- controls -->
            <a class="left carousel-control" href="#my-slider" 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="#my-slider" role="button" data-slide="next">
                <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                <span class="sr-only">Next</span>
            </a>
          </div>
        </div>
      </div>
    </section>

1 个答案:

答案 0 :(得分:0)

不允许将Bootstrap列直接嵌套在其他Bootstrap列中。

Bootstrap列必须始终具有Bootstrap row作为父级。

参考:

https://getbootstrap.com/docs/4.0/layout/grid/#nesting

https://getbootstrap.com/docs/4.0/components/carousel/#with-captions

此外,Bootstrap 4中没有字形。