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-accenton.icc-root: changes the counter, the eyebrow text, focus rings and the arrow hover color.--icc-ratioon.icc-root: sets the photo shape. It is4 / 5on phones,4 / 3from 576px and21 / 9from 768px.--icc-radiuson.icc-root: rounds the slide frame more or less.--bs-carousel-indicator-widthand--bs-carousel-indicator-bgon.icc-carousel: resize and recolor the dots. The active dot is 2.5 times wider.- Swap
theme-warningon.icc-tagfortheme-infoortheme-successto change the badge color. - Add
data-bs-autoplay="true"to.icc-carouselto cycle the photos. Add a.carousel-control-play-pausebutton too, so visitors can stop it. - Replace the Unsplash photos with your own images and keep
width,heightandalton 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.