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 id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
  <ol class="carousel-indicators">
    <li data-target="#carouselExampleIndicators" data-slide-to="0"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="1" class="active"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
  </ol>
  <div class="carousel-inner" role="listbox">
    <div class="carousel-item">
      <img class="d-block" src="/assets/img/bg1.jpg" alt="First slide">
      <div class="carousel-caption d-none d-md-block">
        <h5>Nature, United States</h5>
      </div>
    </div>
    <div class="carousel-item active">
      <img class="d-block" src="/assets/img/bg3.jpg" alt="Second slide">
      <div class="carousel-caption d-none d-md-block">
        <h5>Somewhere Beyond, United States</h5>
      </div>
    </div>
    <div class="carousel-item">
      <img class="d-block" src="/assets/img/bg4.jpg" alt="Third slide">
      <div class="carousel-caption d-none d-md-block">
        <h5>Yellowstone National Park, United States</h5>
      </div>
    </div>
  </div>
  <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
    <i class="now-ui-icons arrows-1_minimal-left"></i>
  </a>
  <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
    <i class="now-ui-icons arrows-1_minimal-right"></i>
  </a>
</div>

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