What is the purpose of using icons inside buttons or input fields in Bootstrap?
Icons help users quickly understand the button or input function by adding a visual clue, making interfaces easier and faster to use.
Click to reveal answer
beginner
How do you add an icon inside a Bootstrap button?
You include an <code><i></code> or <code><svg></code> element with the icon class inside the button element, usually before or after the button text.
Click to reveal answer
intermediate
Which Bootstrap utility classes help align icons and text inside buttons?
Classes like d-flex, align-items-center, and gap-2 help align icons and text nicely inside buttons.
Click to reveal answer
beginner
How can you add an icon inside an input field in Bootstrap?
Use the input-group component with input-group-text to place an icon before or after the input box.
Click to reveal answer
intermediate
Why is it important to use accessible icons in buttons and inputs?
Accessible icons ensure screen readers can describe the icon’s meaning, helping users with disabilities understand the interface.
Click to reveal answer
Which Bootstrap class is used to group an icon and input together?
Abtn-group
Bicon-wrapper
Cform-control
Dinput-group
✗ Incorrect
The input-group class groups inputs and icons or buttons together in Bootstrap.
Where should you place the icon element inside a button for best practice?
AOnly after the button text
BOutside the button element
CBefore or after the button text
DOnly before the button text
✗ Incorrect
Icons can be placed before or after the button text depending on design preference.
Which Bootstrap utility class helps add space between an icon and text inside a button?
Agap-2
Bm-0
Cp-0
Dtext-center
✗ Incorrect
The gap-2 class adds consistent spacing between flex items like icons and text.
What role attribute should you add to an icon for accessibility?
Arole="img"
Brole="button"
Crole="presentation"
Drole="input"
✗ Incorrect
Adding role="img" helps screen readers recognize the icon as an image.
Which Bootstrap component is best for adding an icon inside an input field?
Acard
Binput-group with input-group-text
Cform-floating
Dbtn-group
✗ Incorrect
The input-group with input-group-text is designed to add icons or text inside input fields.
Explain how to add an icon inside a Bootstrap button and how to align it properly with the button text.
Think about how to combine icon and text visually inside a button.
You got /4 concepts.
Describe the method to include an icon inside an input field using Bootstrap components.
Bootstrap input groups are designed for this purpose.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of adding icons inside Bootstrap buttons or inputs?
easy
A. To increase the size of buttons automatically
B. To make buttons and inputs easier to understand visually
C. To change the button color to blue
D. To disable the input field
Solution
Step 1: Understand the role of icons in UI
Icons provide visual clues that help users quickly understand the purpose of buttons or inputs.
Step 2: Relate to Bootstrap usage
Bootstrap uses icons to improve user experience by making controls more intuitive.
Final Answer:
To make buttons and inputs easier to understand visually -> Option B
Quick Check:
Icons improve clarity = A [OK]
Hint: Icons help users recognize actions quickly [OK]
Common Mistakes:
Thinking icons change button size automatically
Assuming icons change colors by default
Believing icons disable inputs
2. Which is the correct way to add a Bootstrap icon inside a button?
easy
A. Search
B. Search
C. Search
D. Search
Solution
Step 1: Identify Bootstrap icon syntax
Bootstrap icons use <i> tags with classes like "bi bi-search".
Step 2: Check each option
<button><i class="bi bi-search"></i> Search</button> uses <i> with correct classes; others use wrong tags or methods.
Final Answer:
<button><i class="bi bi-search"></i> Search</button> -> Option D
Quick Check:
Bootstrap icons use <i> + bi classes = A [OK]
Hint: Use <i> tag with 'bi' classes for Bootstrap icons [OK]