The class modal-xl is applied to the modal-dialog div, which sets the modal to extra large size.
Step 2: Understand the effect of modal-xl
This class makes the modal wider than default and large sizes, so the modal will appear extra large on the screen.
Final Answer:
Extra large modal dialog -> Option C
Quick Check:
modal-xl = extra large modal [OK]
Hint: modal-xl class means extra large modal [OK]
Common Mistakes:
Confusing modal-xl with modal-lg or modal-sm
Thinking modal-xl centers the modal
Ignoring the class and assuming default size
4. You want to make a modal vertically centered and large sized. Which of these code snippets correctly applies both features?
A) <div class="modal-dialog modal-lg modal-dialog-centered">
B) <div class="modal-dialog modal-centered modal-lg">
C) <div class="modal-dialog modal-lg-centered">
D) <div class="modal-dialog modal-lg center-dialog">
medium
A. A
B. B
C. C
D. D
Solution
Step 1: Check correct Bootstrap classes for size and centering
The correct classes are modal-lg for large size and modal-dialog-centered for vertical centering.
Step 2: Verify the class names and order
A uses both classes correctly on the modal-dialog div. Other options use incorrect or non-existent classes.
Final Answer:
Option A -> Option A
Quick Check:
modal-lg + modal-dialog-centered = A [OK]
Hint: Combine modal-lg and modal-dialog-centered on modal-dialog [OK]
Common Mistakes:
Using wrong class names like modal-centered or modal-lg-centered
Placing classes on wrong elements
Missing one of the required classes
5. You want to create a responsive modal that is small on mobile, large on tablets, and extra large on desktops, and also vertically centered. Which Bootstrap classes should you apply to the modal-dialog to achieve this?
hard
A. modal-dialog modal-sm modal-lg modal-xl modal-dialog-centered
B. modal-dialog modal-dialog-centered plus custom CSS media queries for sizes
C. modal-dialog modal-dialog-centered modal-sm modal-lg modal-xl
D. modal-dialog modal-dialog-centered modal-sm modal-lg modal-xl with responsive utility classes for each breakpoint
Solution
Step 1: Understand Bootstrap modal size classes
Bootstrap modal size classes like modal-sm, modal-lg, and modal-xl are not responsive by themselves and cannot be combined to change size at different screen widths.
Step 2: Identify how to make modal responsive
To have different modal sizes on different devices, you must use modal-dialog-centered for vertical centering and write custom CSS media queries to adjust modal width responsively.
Final Answer:
modal-dialog modal-dialog-centered plus custom CSS media queries for sizes -> Option B