BBS5 Modal
Learn how to create modal dialog boxes.
BS5 Modal
The Modal is a dialog box/popup window that is displayed on top of the current page.
Creating a Modal
A modal involves a container with .modal, a dialog .modal-dialog, and content .modal-content.
The .modal-content is usually divided into .modal-header, .modal-body, and .modal-footer.
Fading Modal
Add the .fade class to the .modal container to add a fade effect when opening and closing the modal.
Examples
Basic Modal
html/cssA standard modal dialog.
<!-- Button to Open the Modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal">
Open modal
</button>
<!-- The Modal -->
<div class="modal" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Modal Heading</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<!-- Modal body -->
<div class="modal-body">
Modal body..
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>Centered Modal
html/css