Bootstrap 3 Carousel

Add scrolling images or text to your website with the Bootstrap carousel component.

The Bootstrap carousel component enables you to add scrolling images and text that slide in, pause, then slide out. Controls enable the user to scroll forwards or backwards within the set. Basically a scrolling marquee with user controls.

Explanation

To create a basic carousel, apply .carousel and .slide to an outer container (with its own ID).

For the scrollable contents, wrap all items in a .carousel-inner and give each item an .item class.

For the "indicator" controls (the little clickable circles at the bottom, center), add a list with .carousel-indicators, as well as the applicable .data-target and .data-slide-to attributes.

For the "Previous/Next" controls, use an <a> with class="left carousel-control" for the "Previous" button, and class="right carousel-control" for the "Next" button.

Also, you must apply .active to one of the slides in the carousel, otherwise the carousel won't be visible. This class allows you to set one slide as the initial slide (i.e. the starting slide).

I've also added my own styles to center the images horizontally in the carousel.

Captions

You can add captions to your slideshow by adding a <div> with the .carousel-caption class applied. This goes inside each .item.

Bootstrap 3 vs Bootstrap 4

Bootstrap 3 uses .item for each carousel item.

Bootstrap 4 uses .carousel-item for each carousel item.