A. The class should be btn-close-icon instead of btn-close
B. Missing type="button" attribute causes it not to render
C. The aria-label attribute must be 'close-button' instead of 'Close'
D. Including text 'X' inside the button breaks the icon display
Solution
Step 1: Check button content rules
The Bootstrap close button uses an empty button with no inner text to show the X icon via CSS.
Step 2: Understand effect of adding text
Adding 'X' inside overrides the icon and breaks the styling, so the button looks wrong or missing.
Final Answer:
Including text 'X' inside the button breaks the icon display -> Option D
Quick Check:
Close button must be empty inside [OK]
Hint: Close button must be empty inside, no text allowed [OK]
Common Mistakes:
Assuming type="button" is required to show button
Changing aria-label text unnecessarily
Using wrong class name for close button
5. You want to create a modal with a close button in the top-right corner using Bootstrap. Which code snippet correctly adds an accessible close button inside the modal header?
hard
A.
Modal title
B.
Modal title
C.
Modal title
D.
Modal title
X
Solution
Step 1: Confirm correct element and classes for modal close
The close button inside a modal header must be a button with class btn-close and data-bs-dismiss="modal" to close the modal.
Step 2: Check accessibility attributes
It must have aria-label="Close" so screen readers understand its purpose.
Final Answer:
Modal header with button type="button", class btn-close, data-bs-dismiss="modal", and aria-label="Close" -> Option B
Quick Check:
Modal close button = btn-close + data-bs-dismiss + aria-label [OK]
Hint: Modal close button needs data-bs-dismiss="modal" and aria-label [OK]
Common Mistakes:
Adding text inside the button breaks icon
Using <span> instead of <button>
Missing data-bs-dismiss attribute
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.