Ogum
Ogum

Reputation: 379

Customize carousel with bootstrap 3

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:

.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

Upvotes: 4

Views: 31129

Answers (1)

Carol Skelly
Carol Skelly

Reputation: 362290

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

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:

html,body {
  height:100%;
}

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

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

Upvotes: 2

Related Questions