Skip to content

Image Carousel with Captions

Dark Bootstrap 6 photo carousel with overlay captions, location badges, indicators, prev/next controls and a live slide counter, built on scroll-snap.

Also known as: photo carousel with captions, image slider with text overlay, photo gallery slider, travel photo slideshow

Image Carousel with Captions live demo

Open in new tab

Bootstrap 6 code (HTML, CSS, JS)

A dark, editorial photo carousel for Bootstrap 6 with a caption on every slide: a location badge, a serif headline, a short story and a camera-settings line. It suits travel blogs, portfolio pages and photo essays where each image needs context, not just a pretty picture.

How it works

The root .icc-root pins data-bs-theme="dark" so the component looks the same in light and dark mode. Inside, .icc-carousel is a Bootstrap 6 .carousel.carousel-overlay. Bootstrap 6 builds the carousel on CSS scroll-snap, so .carousel-inner is a real horizontal scroll container and swiping, trackpad scrolling and arrow keys all work natively.

Each slide is a <figure class="carousel-item icc-slide"> with an <img class="icc-img"> and a <figcaption class="icc-caption">. Bootstrap 6 dropped .carousel-caption, so the caption is positioned with your own CSS. A gradient on .icc-slide::after keeps the text readable on bright skies.

The indicators and the round prev/next buttons sit in .carousel-overlay-controls, which Bootstrap 6 places over the bottom of the slides. The script imports Carousel, creates the instance on load so scrolling also updates the indicators, and listens to slid.bs.carousel to update the 01 / 04 counter in .icc-current. The default ends: 'loop' scrolls on from the last photo into the first instead of jumping back.

Customization

  • --icc-accent on .icc-root: changes the counter, the eyebrow text, focus rings and the arrow hover color.
  • --icc-ratio on .icc-root: sets the photo shape. It is 4 / 5 on phones, 4 / 3 from 576px and 21 / 9 from 768px.
  • --icc-radius on .icc-root: rounds the slide frame more or less.
  • --bs-carousel-indicator-width and --bs-carousel-indicator-bg on .icc-carousel: resize and recolor the dots. The active dot is 2.5 times wider.
  • Swap theme-warning on .icc-tag for theme-info or theme-success to change the badge color.
  • Add data-bs-autoplay="true" to .icc-carousel to cycle the photos. Add a .carousel-control-play-pause button too, so visitors can stop it.
  • Replace the Unsplash photos with your own images and keep width, height and alt on every <img>.

Use cases

  • Travel blogs: each destination photo carries a location badge, headline and short story right on the slide
  • Photography portfolios: show camera settings under every image while visitors swipe through the series
  • Photo essays and editorials: give each picture context with an overlay caption and a slide counter
  • Event recap pages: let visitors page through highlights with indicators and prev/next arrows

Accessibility

The carousel is a labelled region with aria-roledescription="carousel", and each slide is a group with aria-roledescription="slide" and an "n of 4" label. .carousel-inner is focusable, so keyboard users can move with the Left and Right arrow keys. Every control has a visible name, the indicators carry aria-current, and the counter is a polite live region. Photos have descriptive alt text. Bootstrap 6 turns the smooth scroll into an instant jump under prefers-reduced-motion.

Bootstrap 6 notes

Bootstrap 5 developers will miss .carousel-caption, .carousel-control-prev and data-bs-ride. In Bootstrap 6 the controls are ordinary buttons with data-bs-slide and the .carousel-icon-prev / .carousel-icon-next icons, and .carousel-overlay replaces the absolutely positioned controls. Badges use badge badge-subtle theme-warning instead of text-bg-*. This snippet is built on 6.0.0-alpha.1, so class names and options may still change. The photos come from Unsplash; replace them with your own images. Icons come from Bootstrap Icons.

Image Carousel with Captions at a glance

Framework
Bootstrap 6
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 6, Bootstrap Icons
Layout
Responsive, works on mobile, dark design
Category
Carousels
License
Free for personal and commercial use

Questions about this template

Can I use the Image Carousel with Captions code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 6 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@6.0.0-alpha.1/dist/css/bootstrap.min.css">
  • <script type="module" src="https://cdn.jsdelivr.net/npm/bootstrap@6.0.0-alpha.1/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">

Built for Bootstrap 6.0.0-alpha.1. Bootstrap 6 ships as an ES module, so its script and this component's JavaScript load with type="module". Alpha releases can still change before the stable version.

Image Carousel with Captions – free Bootstrap 6 carousel template
Image Carousel with Captions · free Bootstrap 6 carousel template

More Carousels

3D Coverflow Image Carousel – free Pure CSS carousel template

3D Coverflow Image Carousel

Coverflow-style image carousel with rotated 3D side photos, reflections, captions, dots, swipe and keyboard navigation in pure CSS and vanilla JS.

Scroll-Snap Carousel – free Pure CSS carousel template

Scroll-Snap Carousel

Native CSS scroll-snap carousel with arrow buttons, synced pill dots and keyboard support, enhanced by a few lines of vanilla JavaScript.

Infinite Auto-Scrolling Image Strip – free Pure CSS carousel template

Infinite Auto-Scrolling Image Strip

Seamless pure CSS marquee of landscape photos that loops forever, pauses on hover or focus and has a Pause/Play button.

Image Carousel with Thumbnails – free Tailwind CSS carousel template

Image Carousel with Thumbnails

Tailwind CSS image carousel with a clickable thumbnail strip, captions, swipe support, arrow-key navigation and optional looping.

Product Carousel with Thumbnails – free Bootstrap 6 carousel template

Product Carousel with Thumbnails

Bootstrap 6 product image carousel with a thumbnail rail, photo counter and arrows, next to a buy box with edition picker, quantity stepper and add to cart.

Testimonial Carousel – free Bootstrap 6 carousel template

Testimonial Carousel

Bootstrap 6 testimonial carousel with crossfading customer quotes, avatars, star ratings, an autoplay progress indicator and a play/pause control.