twitter-bootstrap 使用 bootstrap 3 自定义轮播

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19545589/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 18:57:06  来源:igfitidea点击:

Customize carousel with bootstrap 3

twitter-bootstraptwitter-bootstrap-3

提问by Ogum

I'm trying to customize the carousel of this template http://startbootstrap.com/templates/modern-business/I need to insert the carousel inside the standard bootstrap 3 container class:

我正在尝试自定义此模板的轮播http://startbootstrap.com/templates/modern-business/我需要在标准引导程序 3 容器类中插入轮播:

.container {
 padding-right: 15px;
 padding-left: 15px;
 margin-right: auto;
 margin-left: auto;
} 

The problem is if I enter the carousel inside that class, it disappears, can not see anything...

问题是如果我进入那个班级里面的轮播,它消失了,什么也看不到......

This is the code of the carousel:

这是轮播的代码:

<div id="myCarousel" class="carousel slide">
  <!-- 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="fill" style="background-image:url('http://placehold.it/1900x1080&text=Slide One');"></div>
        <div class="carousel-caption">
          <h1>Modern Business - A Bootstrap 3 Template</h1>
        </div>
      </div>
      <div class="item">
        <div class="fill" style="background-image:url('http://placehold.it/1900x1080&text=Slide Two');"></div>
        <div class="carousel-caption">
          <h1>Ready to Style &amp; Add Content</h1>
        </div>
      </div>
      <div class="item">
        <div class="fill" style="background-image:url('http://placehold.it/1900x1080&text=Slide Three');"></div>
        <div class="carousel-caption">
          <h1>Additional Layout Options at <a href="http://startbootstrap.com">http://startbootstrap.com</a></h1>
        </div>
      </div>
    </div>

    <!-- Controls -->
    <a class="left carousel-control" href="#myCarousel" data-slide="prev">
      <span class="icon-prev"></span>
    </a>
    <a class="right carousel-control" href="#myCarousel" data-slide="next">
      <span class="icon-next"></span>
    </a>
</div>

How can I solve this problem? Thanks

我怎么解决这个问题?谢谢

采纳答案by Zim

If you inspect the template, you'll see that custom CSS is defined in:

如果您检查模板,您将看到自定义 CSS 定义在:

http://startbootstrap.com/templates/modern-business/css/modern-business.css

http://startbootstrap.com/templates/modern-business/css/modern-business.css

Some of these styles make the carousel and several other containers 100% height and width. You can add some CSS overrides to achieve the same affect:

其中一些样式使旋转木马和其他几个容器具有 100% 的高度和宽度。您可以添加一些 CSS 覆盖来实现相同的效果:

html,body {
  height:100%;
}

.carousel-inner,.carousel,.item,.container,.fill {
  height:100%;
  width:100%;
}

Demo: http://www.bootply.com/89646

演示:http: //www.bootply.com/89646