Ask any question about Bootstrap here... and get an instant response.
Post this Question & Answer:
How can I customize Bootstrap's default carousel animation speed?
Asked on Apr 08, 2026
Answer
To customize the animation speed of Bootstrap's carousel, you can adjust the `transition` property in CSS. This allows you to control how quickly the slides transition from one to another.
<!-- BEGIN COPY / PASTE -->
<style>
.carousel-item {
transition: transform 2s ease-in-out;
}
</style>
<div id="carouselExample" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="..." class="d-block w-100" alt="...">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExample" 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="#carouselExample" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<!-- END COPY / PASTE -->Additional Comment:
✅ Answered with Bootstrap 5 best practices.- The CSS rule `.carousel-item { transition: transform 2s ease-in-out; }` changes the transition duration to 2 seconds. You can adjust the `2s` to any desired time.
- Ensure that your carousel's HTML structure is correct and includes the necessary Bootstrap classes and attributes.
- This change affects only the animation speed, not the interval between automatic slide transitions. Adjust the `data-bs-interval` attribute on the `.carousel` element for that.
Recommended Links:
