0
0
Bootsrapmarkup~20 mins

Multi-target collapse in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Multi-target Collapse Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
How does multi-target collapse work in Bootstrap?
In Bootstrap, when you use a button to toggle multiple collapse targets at once, what happens when the button is clicked?
AOnly the first targeted collapse element toggles, others remain unchanged.
BThe button toggles all collapse elements but only one can be visible at a time.
CAll targeted collapse elements toggle their visibility simultaneously.
DThe button toggles the visibility of the first target and hides the rest.
Attempts:
2 left
💡 Hint
Think about what happens when multiple IDs are listed in the data-bs-target attribute.
📝 Syntax
intermediate
2:00remaining
Identify the correct syntax for multi-target collapse button
Which of the following button elements correctly toggles two collapse elements with IDs #panel1 and #panel2 simultaneously?
A<button class="btn btn-primary" data-bs-toggle="collapse" data-bs-target="#panel1, #panel2">Toggle Panels</button>
B<button class="btn btn-primary" data-toggle="collapse" data-target="#panel1 #panel2">Toggle Panels</button>
C<button class="btn btn-primary" data-bs-toggle="collapse" data-bs-target="#panel1;#panel2">Toggle Panels</button>
D<button class="btn btn-primary" data-bs-toggle="collapse" data-bs-target="#panel1 #panel2">Toggle Panels</button>
Attempts:
2 left
💡 Hint
Remember the correct attribute names and how to separate multiple selectors.
rendering
advanced
2:00remaining
What is the visual result of this multi-target collapse code?
Given the following HTML snippet, what will the user see after clicking the button once?

<button class="btn btn-secondary" data-bs-toggle="collapse" data-bs-target="#box1, #box2">Toggle Boxes</button>
<div id="box1" class="collapse show">Box 1 Content</div>
<div id="box2" class="collapse">Box 2 Content</div>
ABoth Box 1 and Box 2 remain visible because Box 1 was already shown.
BBox 1 hides and Box 2 shows, so both boxes toggle their visibility.
COnly Box 2 toggles visibility; Box 1 stays visible.
DBoth boxes hide and disappear from view.
Attempts:
2 left
💡 Hint
Check the initial visibility states and what toggling does to each.
selector
advanced
2:00remaining
Which CSS selector targets all collapse elements toggled by a multi-target button?
If a button toggles multiple collapse elements with IDs #panelA and #panelB, which CSS selector correctly selects both panels?
A#panelA #panelB
B#panelA + #panelB
C.collapse #panelA, .collapse #panelB
D#panelA, #panelB
Attempts:
2 left
💡 Hint
Think about how to select multiple elements by ID in CSS.
accessibility
expert
2:00remaining
How to ensure accessibility for a multi-target collapse button?
Which ARIA attribute should be used on a button that toggles multiple collapse regions to properly inform screen readers?
AUse <code>aria-controls</code> listing all target IDs separated by spaces.
BUse <code>aria-expanded</code> with a comma-separated list of true/false values.
CUse <code>aria-labelledby</code> referencing the button's own ID.
DUse <code>aria-hidden</code> set to false on the button.
Attempts:
2 left
💡 Hint
ARIA attributes help screen readers know which elements the button controls.