Challenge - 5 Problems
Input Group Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediateWhat will this Bootstrap input group render?
Look at the following Bootstrap input group code. What will you see in the browser?
Bootsrap
<div class="input-group mb-3"> <span class="input-group-text" id="basic-addon1">@</span> <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1"> </div>
Attempts:
2 left
💡 Hint
Remember that adds a styled box inside the input group.
✗ Incorrect
Bootstrap's input group places the with class input-group-text inside the input border on the left side, visually attached to the input box.
❓ selector
intermediateWhich class adds a button inside a Bootstrap input group?
You want to add a clickable button inside a Bootstrap input group. Which class should you use on the button element?
Attempts:
2 left
💡 Hint
Bootstrap buttons always use the 'btn' class.
✗ Incorrect
To add a button inside an input group, use a button element with class 'btn' and optionally 'btn-primary' or others. 'input-group-text' is for static text, not buttons.
🧠 Conceptual
advancedWhat is the purpose of aria-describedby in Bootstrap input groups?
In Bootstrap input groups, the input often has an attribute like aria-describedby="basic-addon1". What does this attribute do?
Attempts:
2 left
💡 Hint
Think about how screen readers understand form controls.
✗ Incorrect
aria-describedby links the input to another element that describes it, so screen readers can read the description, making forms more accessible.
❓ layout
advancedHow to place a button on the right side inside a Bootstrap input group?
You want a text input with a button attached on the right side inside the same input group. Which code snippet achieves this?
Attempts:
2 left
💡 Hint
The order of elements inside input-group determines their position.
✗ Incorrect
In Bootstrap input groups, elements appear in the order they are written. To have a button on the right, place the input first, then the button.
❓ accessibility
expertWhich attribute is essential for screen reader users to understand input groups with multiple addons?
When an input group has multiple addons (like prefix and suffix text), which attribute should be used on the input to ensure screen readers read all descriptions correctly?
Attempts:
2 left
💡 Hint
aria-describedby can reference multiple elements by listing their IDs separated by spaces.
✗ Incorrect
Using aria-describedby with multiple IDs separated by spaces lets screen readers read all related addon texts, improving accessibility for complex input groups.
