Carousels & Slideshows

Rotating content displays with navigation controls

1 Basic Carousel

The simplest carousel with automatically sliding images.

Carousel Structure:
<div class="carousel slide" data-bs-ride="carousel">
  <div class="carousel-inner">
    <div class="carousel-item active">...</div>
    <div class="carousel-item">...</div>
  </div>
  <button class="carousel-control-prev">...</button>
  <button class="carousel-control-next">...</button>
</div>
💡 Key Concept: The data-bs-ride="carousel" attribute starts auto-play. The first .carousel-item must have the .active class.

2 With Indicators

Add indicator dots to show the current slide and allow direct navigation.

Indicators:
<div class="carousel-indicators">
  <button data-bs-slide-to="0" class="active"></button>
  <button data-bs-slide-to="1"></button>
  <button data-bs-slide-to="2"></button>
</div>

3 With Captions

Add overlay text to your slides with .carousel-caption .

⚠️ Responsiveness: Captions use .d-none .d-md-block to hide on small screens where text might be unreadable.

4 Crossfade Effect

Change the default slide effect to a fade transition by adding .carousel-fade .

5 Practical Example: Customer Testimonials

Carousels aren't just for images. Use them to showcase testimonials, reviews, or any content.

🎯 Auto-play

data-bs-ride="carousel"

⏱️ Interval

data-bs-interval="5000"

🔄 Infinite Loop

Automatic by default

⌨️ Keyboard Navigation

Left/right arrows

👆 Touch/Swipe

On mobile devices

♿ Accessibility

ARIA included

🎯 Key Takeaways About Carousels

  • Versatile: Works with images, text, cards, and any HTML content
  • Configurable: Control over intervals, auto-play, transition effects
  • Accessible: Includes keyboard navigation and ARIA attributes
  • Responsive: Automatically adapts to screen size
  • No JavaScript: Works entirely with data attributes