0
0
Bootsrapmarkup~20 mins

Collapse component in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Bootstrap Collapse Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
How does the Bootstrap Collapse component work?
Which statement best describes how the Bootstrap Collapse component controls the visibility of content?
AIt uses JavaScript to hide the content by setting visibility to 'hidden' without changing layout.
BIt removes the content from the DOM when collapsed and adds it back when expanded.
CIt changes the display property between 'block' and 'none' instantly without animation.
DIt toggles the height of the content between 0 and its full height using CSS transitions.
Attempts:
2 left
💡 Hint
Think about how smooth animations are achieved in Bootstrap Collapse.
📝 Syntax
intermediate
2:00remaining
Identify the correct data attribute to trigger a collapse
Which data attribute correctly triggers a Bootstrap Collapse toggle when added to a button?
Adata-collapse="toggle"
Bdata-toggle="collapse"
Cdata-target="#collapse"
Ddata-trigger="collapse"
Attempts:
2 left
💡 Hint
Bootstrap uses a specific data attribute to identify toggle elements.
rendering
advanced
2:00remaining
What is the visual result of this Collapse HTML snippet?
Given the following HTML, what will the user see when the page loads?
Bootsrap
<button class="btn btn-primary" data-toggle="collapse" data-target="#info">Toggle Info</button>
<div id="info" class="collapse show">
  <p>This is some collapsible content.</p>
</div>
AThe paragraph is visible initially and can be hidden by clicking the button.
BThe paragraph is hidden initially and appears when the button is clicked.
CThe button is disabled and does not toggle the paragraph visibility.
DThe paragraph is always visible and does not collapse.
Attempts:
2 left
💡 Hint
Look at the class applied to the collapsible div.
selector
advanced
2:00remaining
Which CSS selector targets only expanded collapse elements?
In Bootstrap, which CSS selector matches only the collapse elements that are currently expanded (visible)?
A.collapse[hidden]
B.collapse:not(.show)
C.collapse.show
D.collapse[aria-expanded="false"]
Attempts:
2 left
💡 Hint
Expanded collapse elements have a specific class added by Bootstrap.
accessibility
expert
2:00remaining
Which ARIA attribute correctly reflects the state of a collapse toggle button?
For accessibility, which ARIA attribute should be updated on a button that toggles a Bootstrap Collapse element to indicate its expanded or collapsed state?
Aaria-expanded
Baria-hidden
Caria-pressed
Daria-controls
Attempts:
2 left
💡 Hint
This attribute is a boolean that tells screen readers if content is visible.