VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstrap-5-carousel/

⇱ Bootstrap 5 Carousel - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Carousel

Last Updated : 29 Jul, 2024

Bootstrap 5 Carousel is a slideshow component for cycling through images or slides, allowing users to showcase multiple pieces of content in a visually appealing and interactive way. It offers various options for customization and responsive design.

Bootstrap Carousel Classes:

ClassDescription
carouselApplied to the main container div to initialize the carousel.
carousel-slideApplied to individual slides within the carousel.
carousel-innerApplied to a container div to hold all the slides.
carousel-itemApplied to each slide within the carousel inner container.
carousel-control-prevApplied to the left navigation control button.
carousel-control-nextApplied to the right navigation control button.
carousel-control-prev-iconApplied to the icon inside the left navigation control button.
carousel-control-next-iconApplied to the icon inside the right navigation control button.
carousel-indicatorsApplied to a container ul to hold the slide indicators.
activeApplied to the active slide and indicator to indicate the currently displayed slide.

.carousel-caption

to add a caption to the slide.

Examples of Bootstrap 5 Carousel

Example: This is a Bootstrap 5 carousel with previous and next arrows styled black. It displays images with slide indicators and navigation controls, allowing users to navigate through the carousel slides.

Output:

Add Captions to Slides:

Use .carousel-caption class inside the .carousel-item class to add a caption to the slide.

Example: Bootstrap Carousel with indicators, captions, and navigation controls. Customized indicators and captions with Bootstrap classes. Slide transition and navigation controlled by Bootstrap JavaScript.

Output:

Comment
Article Tags:

Explore