Challenge - 5 Problems
Icon Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediateWhat size will this Bootstrap icon appear?
Given the following HTML code using Bootstrap icons, what will be the visual size of the icon in the browser?
Bootsrap
<i class="bi bi-alarm" style="font-size: 3rem;"></i>
Attempts:
2 left
💡 Hint
Remember that inline styles with font-size affect icon size.
✗ Incorrect
Bootstrap icons inherit font size from their container or inline styles. Setting font-size: 3rem makes the icon three times the root font size, so it appears large.
❓ selector
intermediateWhich CSS selector changes only the color of Bootstrap icons inside buttons?
You want to change the color of all Bootstrap icons that are inside
Attempts:
2 left
💡 Hint
Think about selecting icons inside buttons, not buttons inside icons.
✗ Incorrect
The selector 'button .bi' targets elements with class 'bi' that are descendants of
🧠 Conceptual
advancedWhy might a Bootstrap icon not change color when you apply a CSS color property?
You apply 'color: green;' to a Bootstrap icon element, but the icon color does not change. What is the most likely reason?
Attempts:
2 left
💡 Hint
Consider how SVG icons handle colors differently than fonts.
✗ Incorrect
Bootstrap icons are SVGs that may have a fixed fill color. The CSS 'color' property affects font icons but not SVG fill unless the SVG uses 'currentColor' for fill.
❓ layout
advancedHow to vertically center a Bootstrap icon next to text inside a button?
You have a button with text and a Bootstrap icon side by side. The icon appears slightly off vertically. Which CSS approach best centers the icon vertically with the text?
Bootsrap
<button class="btn btn-primary"><i class="bi bi-star"></i> Favorite</button>
Attempts:
2 left
💡 Hint
Flexbox is great for aligning items vertically.
✗ Incorrect
Setting the button to 'display: flex' and 'align-items: center' aligns the icon and text vertically in the center, fixing the offset.
❓ accessibility
expertHow to make a Bootstrap icon accessible for screen readers when it conveys meaning?
You use a Bootstrap icon as a button to submit a form. The icon alone has no text. What is the best way to make this icon accessible to screen readers?
Bootsrap
<button type="submit" class="btn btn-success"><i class="bi bi-check-lg"></i></button>
Attempts:
2 left
💡 Hint
Screen readers need descriptive labels on interactive elements.
✗ Incorrect
Adding 'aria-label' to the button gives screen readers a text description of the button's purpose, making the icon accessible.
