Javatpoint Logo
Javatpoint Logo

Bootstrap 5 carousel

Bootstrap 5 carousel is a slideshow that cycles through various content using classes. It works with a collection of pictures, text, or unique markup elements. Additionally, it supports previous and next indicators and buttons.

The following table shows carousel classes with a detailed description.

Class Description
"carousel" It creates a carousel function on the web page.
"carousel-indicators" This class provides more carousel indicators. It indicates the number of slides in the carousel and which slide the user is currently showing or working on. The tiny dots on each slide's bottom represent the slide's indicator.
"carousel-inner" It inserts slides in the carousel class.
"carousel-item" It specifies the data or information on the carousel slide.
"carousel-control-prev" It provides a previous or left button to the carousel. It allows the user to go to the previous slide of the carousel.
"carousel-control-next" It provides a next or right button to the carousel. It allows the user to go next slide of the carousel.
"carousel-control-next-icon" It comes with the carousel-control-next to create a "next or right side" button.
"carousel-control-prev-icon" It comes with the "carousel-control-prev" class to create a "previous or left side" button.
"slide" It provides a CSS style transition and animation effect to the carousel function. It slides from one item to the next. The carousel function removes the class if you do not want this effect.

Basic carousel

The basic carousel uses different images in the slides with the next and previous buttons. This function uses on top of the web application. It attracts users' interaction and shows essential information.

Syntax

The following syntax shows basic carousel function using bootstrap 5 classes.

The following syntax shows basic previous and next button for carousel function.

Example

The following example uses four slides with images. It shows next and previous button.

Output

The following output shows the carousel function with images.

Bootstrap 5 carousel

Basic carousel with indicator

The carousel function includes an indicator to show many slides are available in the function. The indicator shows the current working slide, previous slides and next slides.

Syntax

The following syntax shows carousel function with indicator using bootstrap 5 classes.

Example

The following example uses four slides with indicator. The first slide is active with active indicator. The other slides can use with next and previous buttons and imdicators.

Output

The following output shows the carousel function with indicators.

Bootstrap 5 carousel

Basic carousel with the caption

The carousel function includes extra information with the slide. It shows information, content and heading of the carousel function.

Syntax

The following syntax shows carousel function with caption using bootstrap 5 classes.

Example

The following example uses four slides with indicator. The first slide is active with active indicator.

Output

The following output shows the carousel function with caption.

Bootstrap 5 carousel

Basic carousel with interval

The carousel function shows essential information with multiple slides. The slides move automatically after some interval. We can set a time limit on the image displayed on the web screen.

Syntax

The following syntax shows carousel function with interval using bootstrap 5 classes.

Example

The following example uses three slides with interval. The first slide is active with large size interval than the other slides.

Output

The following output shows the carousel function with intervals.

Bootstrap 5 carousel

Dark Carousel

The carousel function uses the "carousel-dark" to display indicators, buttons and other info in dark colours. According to the web page template, it gives an attractive, stylish, and interactive carousel function.

Syntax

The following syntax shows carousel function with interval using bootstrap 5 classes.

Example

The following example uses two slides with interval and dark carousel.

Output

The following output shows the dark carousel function with intervals.

Bootstrap 5 carousel

Conclusion

The bootstrap 5 carousel function displays essential and interactive information on the web page. It shows information, heading and images to the users and attracts interaction of the users. It works for e-commerce, advertisement and other websites for showing important data.


Next TopicBootstrap 5 navbar





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA