A dark Bootstrap 6 carousel that shows several cards at once: one on phones, two from 576px, three from 1024px and four from 1280px. The demo lists online course cards with gradient covers, level badges, lesson counts, ratings and prices. The same pattern works for blog posts, products, team members or case studies.
How it works
.mic-carousel is a Bootstrap 6 .carousel. Bootstrap 6 builds carousels on CSS scroll-snap, so the number of visible slides is pure CSS: the snippet sets --bs-carousel-items and --bs-carousel-items-gap on .mic-carousel and changes them in media queries. No JavaScript is needed for the responsive layout.
Each .carousel-item holds a Bootstrap 6 card with the hover-lift utility. The .mic-cover header uses one of eight gradient classes (.mic-cover--1 to .mic-cover--8) with a Bootstrap Icon, and the title link uses stretched-link, so the whole card is clickable.
The header with the arrows sits inside the .carousel element, and data-bs-ends="stop" makes Bootstrap disable Previous on the first card and Next once the last card is in view. The script imports Carousel and creates the instance on load so this end state is correct immediately. It then listens to the scroll event of .carousel-inner, reads --bs-carousel-items back with getComputedStyle() and writes "Showing 1–3 of 8" into .mic-range. It also moves the lime bar in .mic-track through the --mic-start and --mic-size custom properties.
Customization
--bs-carousel-itemson.mic-carouselin each media query: change how many cards fit per view, for example 5 from 1536px.--bs-carousel-items-gapon.mic-carousel: widens or narrows the space between cards.- Add
--bs-carousel-items-peek: 2remto.mic-carouselto show a slice of the next and previous card. --mic-accenton.mic-root: recolors the Next button, the "Free" price, the eyebrow and the scroll track. It also feeds--bs-primary-bg.--mic-surface,--mic-bgand--mic-lineon.mic-root: set the card, page and divider colors..mic-cover--1to.mic-cover--8: edit thelinear-gradient()values, or replace the cover with an<img>for photo cards.- Change
data-bs-ends="stop"to"wrap"so Next jumps back to the first card at the end.
Use cases
- Online course catalogs: browse course cards with level badges, lesson counts and prices, one to four per view
- Blog and news sites: scroll through related posts as cards with a live showing-range counter
- Ecommerce stores: present featured products in a row that adapts from one card on phones to four on desktop
- Agency case studies: let visitors move through projects with arrows that stop at the first and last card
Accessibility
The carousel is a region labelled by the section heading with aria-roledescription="carousel", and every card is a labelled slide group. .carousel-inner is focusable, so the Left and Right arrow keys move one card at a time. Arrow buttons have hidden text labels and use the native disabled attribute at the ends. The range counter is a polite live region. Keyboard focus on a card title lifts the card and outlines it, mirroring the hover effect. Track movement is disabled under prefers-reduced-motion.
Bootstrap 6 notes
Bootstrap 5 needed custom JavaScript or extra markup to show several items per slide. In Bootstrap 6, --bs-carousel-items does it with CSS. .carousel-control-prev is replaced by plain buttons using .carousel-icon-prev, btn-outline-secondary becomes btn-outline theme-secondary, and badges use badge badge-subtle theme-*. Built on 6.0.0-alpha.1, so details may still change. Icons come from Bootstrap Icons.