Ask any question about Bootstrap here... and get an instant response.
Post this Question & Answer:
How can I customize Bootstrap's modal animations for a unique transition effect? Pending Review
Asked on Mar 27, 2026
Answer
To customize Bootstrap's modal animations for a unique transition effect, you can override the default CSS transitions with your own styles.
<!-- BEGIN COPY / PASTE -->
<style>
.modal.fade .modal-dialog {
transition: transform 0.8s ease-out;
transform: translateY(-100%);
}
.modal.show .modal-dialog {
transform: translateY(0);
}
</style>
<div class="modal fade" id="myModal" tabindex="-1" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel">Custom Modal</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
This is a custom animated modal.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- END COPY / PASTE -->Additional Comment:
✅ Answered with Bootstrap 5 best practices.- The custom CSS transitions are applied to the modal-dialog class within the modal.
- The transition effect is a slide-down animation, achieved by changing the transform property from translateY(-100%) to translateY(0).
- Adjust the transition duration and easing function to fit your design needs.
- Ensure that the modal ID (e.g., myModal) matches the data-bs-target attribute in the button or link that triggers the modal.
Recommended Links:
