0
0
Bootsrapmarkup~20 mins

Horizontal collapse in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Bootstrap Horizontal Collapse Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
What is the visual result of this Bootstrap horizontal collapse code?
Given the following HTML snippet using Bootstrap 5, what will the user see when the button is clicked?
Bootsrap
<button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">Toggle</button>
<div class="collapse collapse-horizontal" id="collapseExample">
  <div class="card card-body" style="width: 200px;">
    This content collapses horizontally.
  </div>
</div>
AThe button does not trigger any change because the collapse-horizontal class is invalid in Bootstrap 5.
BThe content inside the card instantly disappears and reappears vertically without animation when the button is clicked.
CThe content inside the card smoothly expands and collapses horizontally from left to right when the button is clicked.
DThe content inside the card expands vertically with a fade effect when the button is clicked.
Attempts:
2 left
💡 Hint
Focus on the class 'collapse-horizontal' and what it does in Bootstrap 5.
selector
intermediate
1:30remaining
Which CSS selector targets the horizontal collapse content correctly?
You want to style the content inside a Bootstrap horizontal collapse with a red border. Which CSS selector will correctly select the content inside the collapse with id 'myCollapse'?
A#myCollapse.collapse-horizontal > .card-body
B.collapse-horizontal #myCollapse .card-body
C#myCollapse > .collapse-horizontal .card-body
D#myCollapse.collapse-horizontal .card-body
Attempts:
2 left
💡 Hint
Remember that the collapse element has both the id and the class 'collapse-horizontal'.
🧠 Conceptual
advanced
1:00remaining
What ARIA attribute is essential for accessibility in a Bootstrap horizontal collapse button?
Which ARIA attribute must be included on the button toggling a horizontal collapse to inform screen readers about the expanded state?
Aaria-expanded
Baria-hidden
Caria-pressed
Daria-label
Attempts:
2 left
💡 Hint
This attribute changes between true and false to indicate if the content is visible.
📝 Syntax
advanced
1:30remaining
What error occurs if you omit the 'data-bs-target' attribute in a Bootstrap horizontal collapse button?
Consider this button code: <button class="btn btn-primary" data-bs-toggle="collapse">Toggle</button>. What happens when you click it?
ANothing happens because Bootstrap does not know which element to collapse.
BThe page reloads because of missing target attribute.
CA JavaScript error is thrown in the console about missing target.
DThe button toggles all collapse elements on the page.
Attempts:
2 left
💡 Hint
Think about how Bootstrap identifies the collapse element to toggle.
layout
expert
2:30remaining
How does Bootstrap's horizontal collapse affect layout flow compared to vertical collapse?
When using collapse-horizontal, how does the collapsing content affect the surrounding elements' layout differently than the default vertical collapse?
AHorizontal collapse hides content without affecting layout, while vertical collapse pushes content down.
BHorizontal collapse changes the width of the content, pushing or pulling adjacent elements horizontally, while vertical collapse changes height and affects vertical spacing.
CBoth horizontal and vertical collapse only change opacity and do not affect layout flow.
DHorizontal collapse overlays content on top of others without resizing, vertical collapse resizes content.
Attempts:
2 left
💡 Hint
Think about how width and height changes affect page layout differently.