Complete the code to create a Bootstrap close button.
<button type="button" class="btn-close" aria-label="[1]"></button>
The aria-label attribute should describe the button's purpose for screen readers. The standard label for a close button is Close.
Complete the code to add a close button inside a Bootstrap alert.
<div class="alert alert-warning alert-dismissible fade show" role="alert"> Warning! Something went wrong. <button type="button" class="[1]" data-bs-dismiss="alert" aria-label="Close"></button> </div>
btn-close class.The Bootstrap class btn-close styles the button as a close icon. Other class names are not recognized by Bootstrap.
Fix the error in the close button code inside a modal header.
<div class="modal-header"> <h5 class="modal-title">Modal title</h5> <button type="button" class="btn-close" data-bs-dismiss="[1]" aria-label="Close"></button> </div>
The data-bs-dismiss attribute should be set to modal to close the Bootstrap modal properly.
Fill both blanks to create a dismissible Bootstrap toast with a close button.
<div class="toast show" role="alert" aria-live="assertive" aria-atomic="true"> <div class="toast-header"> <strong class="me-auto">Notification</strong> <button type="button" class="[1]" data-bs-dismiss="[2]" aria-label="Close"></button> </div> <div class="toast-body"> Hello, this is a toast message. </div> </div>
The close button uses the btn-close class. The data-bs-dismiss attribute must be set to toast to dismiss the toast component.
Fill all three blanks to create a Bootstrap modal with a close button in the header that dismisses the modal.
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Modal title</h5> <button type="button" class="[1]" data-bs-dismiss="[2]" aria-label="[3]"></button> </div> <div class="modal-body"> Modal body content goes here. </div> </div> </div> </div>
The close button uses the btn-close class. The data-bs-dismiss attribute must be modal to close the modal. The aria-label should be Close for accessibility.