Challenge - 5 Problems
Modal Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate2:00remaining
What size will this Bootstrap modal have?
Given the following modal HTML code, what size will the modal be when opened?
<div class="modal fade" id="exampleModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Large Modal</h5>
</div>
<div class="modal-body">Content here</div>
</div>
</div>
</div>Bootsrap
<div class="modal fade" id="exampleModal" tabindex="-1" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Large Modal</h5> </div> <div class="modal-body">Content here</div> </div> </div> </div>
Attempts:
2 left
💡 Hint
Look at the class inside the modal-dialog div.
✗ Incorrect
The class 'modal-lg' on the modal-dialog sets the modal width to large size in Bootstrap.
🧠 Conceptual
intermediate2:00remaining
How to center a Bootstrap modal vertically?
Which class should you add to the modal-dialog div to vertically center the modal on the screen?
Attempts:
2 left
💡 Hint
Bootstrap uses a specific naming pattern for vertical centering modals.
✗ Incorrect
The correct Bootstrap class to vertically center a modal is 'modal-dialog-centered'.
📝 Syntax
advanced2:00remaining
What error occurs with this modal code?
What error or problem will happen if you use this modal HTML?
<div class="modal fade" id="myModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-fullscreen-sm-down">
<div class="modal-content">
<div class="modal-header">Header</div>
<div class="modal-body">Body</div>
</div>
</div>
</div>Bootsrap
<div class="modal fade" id="myModal" tabindex="-1" aria-hidden="true"> <div class="modal-dialog modal-fullscreen-sm-down"> <div class="modal-content"> <div class="modal-header">Header</div> <div class="modal-body">Body</div> </div> </div> </div>
Attempts:
2 left
💡 Hint
Check the meaning of 'modal-fullscreen-sm-down' class in Bootstrap docs.
✗ Incorrect
The class 'modal-fullscreen-sm-down' makes the modal fullscreen on small screens and smaller, normal on medium and larger.
❓ selector
advanced2:00remaining
Which CSS selector targets only the modal content inside a centered modal?
You want to style the modal content only when the modal is vertically centered. Which CSS selector is correct?
Attempts:
2 left
💡 Hint
Remember the modal-dialog-centered class is on the modal-dialog div, and modal-content is inside it.
✗ Incorrect
The selector '.modal-dialog-centered .modal-content' selects modal-content inside any element with modal-dialog-centered class.
❓ accessibility
expert2:00remaining
Which ARIA attribute is essential for accessible modals?
For a Bootstrap modal to be accessible, which ARIA attribute must be present on the modal container to describe its label?
Attempts:
2 left
💡 Hint
This attribute links the modal to its title for screen readers.
✗ Incorrect
The 'aria-labelledby' attribute points to the modal's title element, helping screen readers announce the modal's purpose.