Carousel

A slideshow component for cycling through elements—images or slides of text—like a carousel.

How it works

The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms and a bit of JavaScript. It works with a series of images, text, or custom markup. It also includes support for previous/next controls and indicators.

In browsers where the Page Visibility API is supported, the carousel will avoid sliding when the webpage is not visible to the user (such as when the browser tab is inactive, the browser window is minimized, etc.).

Please be aware that nested carousels are not supported, and carousels are generally not compliant with accessibility standards.

Lastly, if you’re building our JavaScript from source, it requires util.js.

Example

Carousels don’t automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content. While carousels support previous/next controls and indicators, they’re not explicitly required. Add and customize as you see fit.

Be sure to set a unique id on the .carousel for optional controls, especially if you’re using multiple carousels on a single page.

With indicators

You can also add the indicators to the carousel, alongside the controls, too.

<div class="card card-raised page-carousel">
  <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
    <ol class="carousel-indicators">
      <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
      <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
      <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
    </ol>
    <div class="carousel-inner" role="listbox">
        <div class="carousel-item active">
            <img class="d-block img-fluid" src="../../../assets/img/sections/pedro-lastra.jpg" alt="First slide">
          <div class="carousel-caption d-none d-md-block">
                <p>Somewhere</p>
            </div>
        </div>
        <div class="carousel-item">
            <img class="d-block img-fluid" src="../../../assets/img/sections/fabio-mangione.jpg" alt="Second slide">
          <div class="carousel-caption d-none d-md-block">
              <p>Somewhere else</p>
          </div>
        </div>
        <div class="carousel-item">
            <img class="d-block img-fluid" src="../../../assets/img/cover.jpg" alt="Third slide">
          <div class="carousel-caption d-none d-md-block">
              <p>Here it is</p>
          </div>
        </div>
    </div>

    <a class="left carousel-control carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
      <span class="fa fa-angle-left"></span>
      <span class="sr-only">Previous</span>
    </a>
    <a class="right carousel-control carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
      <span class="fa fa-angle-right"></span>
      <span class="sr-only">Next</span>
    </a>
  </div>
</div>

If you want to see more examples and properties please check the official Bootstrap Documentation