Recall & Review
beginner
What is the purpose of
data-bs-target in Bootstrap's collapse component?The data-bs-target attribute tells Bootstrap which element(s) to show or hide when the trigger is clicked. It links the button or link to the collapsible content.
Click to reveal answer
beginner
How can you make one button control multiple collapsible elements in Bootstrap?
<p>You can set <code>data-bs-target</code> to a CSS selector that matches multiple elements, like a class selector (e.g., <code>.multi-collapse</code>). This way, clicking the button toggles all matched elements together.</p>Click to reveal answer
beginner
What role does the <code>.collapse</code> class play in Bootstrap's collapse feature?<p>The <code>.collapse</code> class marks an element as collapsible. It hides the content by default and enables the toggle animation when triggered.</p>Click to reveal answer
intermediate
Why is it important to use semantic HTML elements with Bootstrap collapse components?
Using semantic elements like <button> for triggers improves accessibility. It helps keyboard users and screen readers understand and interact with the collapsible content properly.
Click to reveal answer
intermediate
How does Bootstrap ensure smooth animation when collapsing multiple targets simultaneously?
<p>Bootstrap uses CSS transitions on height and JavaScript to toggle the <code>.show</code> class on all targeted elements. This triggers smooth open/close animations for each element together.</p>Click to reveal answer
Which attribute do you use to specify multiple collapse targets in Bootstrap?
✗ Incorrect
data-bs-target is used to specify one or more elements to collapse or expand.
How do you select multiple elements to collapse with one button?
✗ Incorrect
Using a class selector like .multi-collapse in data-bs-target selects all elements with that class.
What class must collapsible elements have in Bootstrap?
✗ Incorrect
The .collapse class marks elements as collapsible.
Which HTML element is best for a collapse toggle button for accessibility?
✗ Incorrect
<button> is semantic and accessible for toggling content.
What happens when you click a button with
data-bs-target set to multiple elements?✗ Incorrect
All elements matched by the selector toggle their visibility simultaneously.
Explain how to create a button that toggles multiple collapsible sections at once using Bootstrap.
Think about how CSS selectors can target many elements.
You got /4 concepts.
Describe why accessibility matters when using collapse components and how to improve it.
Consider users who rely on keyboards or screen readers.
You got /4 concepts.