HTML CSS Bootstrap JavaScript jQuery MySQL PHP Data Mining

Bootstrap Carousel

The Carousel is a slideshow component for cycling through elements—images or text slices—like a customized interactive slider. It is highly responsive and includes support for indicators, controls, and crossfade animations.


Basic Example (Slides Only)

Here is a basic carousel with just slides. The .carousel-inner contains all slides, and each individual slide wraps around a .carousel-item. Note that one slide must have the .active class to be visible by default.

<div id="carouselExampleSlidesOnly" class="carousel slide" data-bs-ride="carousel">
    <div class="carousel-inner">
        <div class="carousel-item active">
            <img src="image1.jpg" class="d-block w-100" alt="First slide">
        </div>
        <div class="carousel-item">
            <img src="image2.jpg" class="d-block w-100" alt="Second slide">
        </div>
        <div class="carousel-item">
            <img src="image3.jpg" class="d-block w-100" alt="Third slide">
        </div>
    </div>
</div>
Important: You must include the data-bs-ride="carousel" attribute to automatically start animating the carousel on page load.

With Controls

Adding navigational controls allows the user to manually switch slides back and forth. You use a custom <button> paired with .carousel-control-prev and .carousel-control-next.

<!-- Button Controls -->
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="visually-hidden">Next</span>
</button>

With Indicators

You can also add indicators to the carousel, typically placed at the bottom, which let users know how many slides are available and their current position.

<!-- Carousel Indicators -->
<div class="carousel-indicators">
    <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
    <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="1" aria-label="Slide 2"></button>
    <button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="2" aria-label="Slide 3"></button>
</div>

With Captions

To drop brief informative text over your images, embed a .carousel-caption within any .carousel-item. They are hidden on smaller viewports automatically by including the .d-none .d-md-block utility classes.

<div class="carousel-item">
    <img src="image.jpg" class="d-block w-100" alt="...">
    <div class="carousel-caption d-none d-md-block">
        <h5>First slide label</h5>
        <p>Some representative placeholder content for the first slide.</p>
    </div>
</div>

Crossfade Animation

To change the default sliding animation to a fading transition, just add the .carousel-fade class directly to your main .carousel element.

<!-- Crossfade -->
<div id="carouselExampleFade" class="carousel slide carousel-fade" data-bs-ride="carousel">
    ...
</div>