Challenge - 5 Problems
Bootstrap Button Group Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate2:00remaining
What is the visual output of this Bootstrap button group?
Look at the following HTML code using Bootstrap 5. What will you see rendered in the browser?
Bootsrap
<div class="btn-group" role="group" aria-label="Basic example"> <button type="button" class="btn btn-primary">Left</button> <button type="button" class="btn btn-primary">Middle</button> <button type="button" class="btn btn-primary">Right</button> </div>
Attempts:
2 left
💡 Hint
Bootstrap's btn-group class groups buttons horizontally with no gaps.
✗ Incorrect
The btn-group class in Bootstrap groups buttons side-by-side horizontally with no gaps, making them appear connected as a single unit.
❓ selector
intermediate1:30remaining
Which attribute ensures accessibility for a Bootstrap button group?
In Bootstrap button groups, which attribute is important to add for screen readers to understand the group?
Attempts:
2 left
💡 Hint
Think about how screen readers identify groups of controls.
✗ Incorrect
The aria-label attribute provides a descriptive label for the button group, helping screen readers announce the group purpose.
📝 Syntax
advanced2:00remaining
What error occurs with this Bootstrap button group code?
Examine this code snippet. What error or problem will it cause when rendered?
Bootsrap
<div class="btn-group" aria-label="Group"> <button class="btn btn-secondary">One</button> <button class="btn btn-secondary">Two</button> <button class="btn btn-secondary">Three</button> </div>
Attempts:
2 left
💡 Hint
Bootstrap uses role="group" to identify button groups for assistive technologies.
✗ Incorrect
Without role="group", assistive technologies may not recognize the buttons as a group, reducing accessibility.
❓ layout
advanced1:30remaining
How to create a vertical button group in Bootstrap?
Which class combination creates a vertical stack of buttons grouped together in Bootstrap 5?
Attempts:
2 left
💡 Hint
Bootstrap provides a special class for vertical button groups.
✗ Incorrect
The btn-group-vertical class stacks buttons vertically with proper spacing and styling.
🧠 Conceptual
expert2:30remaining
Why use role="group" with aria-label in Bootstrap button groups?
What is the main reason to add role="group" and aria-label attributes to a Bootstrap button group container?
Attempts:
2 left
💡 Hint
Think about accessibility and how assistive devices interpret grouped controls.
✗ Incorrect
role="group" defines the container as a group of related controls, and aria-label gives a descriptive name, helping screen readers and keyboard users understand the group context.