📖 Scenario: You are building a simple webpage for a small business. You want to make the page look friendly and easy to understand by adding icons next to important text. Using Bootstrap icons will help you do this quickly and neatly.
🎯 Goal: Create a basic webpage using Bootstrap that shows a heading and a list of features. Add Bootstrap icons next to each feature to make the page visually clear and attractive.
📋 What You'll Learn
Use Bootstrap 5 CSS and Bootstrap Icons CSS from CDN
Create a heading with the text 'Our Features'
Create an unordered list with three features: 'Fast Service', '24/7 Support', 'Affordable Prices'
Add a relevant Bootstrap icon before each feature text
Make sure the icons and text are aligned nicely
💡 Why This Matters
🌍 Real World
Icons help users quickly understand information on websites, making pages easier to scan and more attractive.
💼 Career
Web developers often use icon libraries like Bootstrap Icons to improve user experience and interface design efficiently.
Progress0 / 4 steps
1
Set up the basic HTML structure with Bootstrap CSS
Create a basic HTML5 page with lang="en", charset="UTF-8", and viewport meta tags. Include the Bootstrap 5 CSS link from the official CDN inside the <head>. Add a <body> with a <main> container where you will add content later.
Bootsrap
Hint
Remember to include the Bootstrap CSS link inside the <head> section.
2
Add Bootstrap Icons CSS and heading
Add the Bootstrap Icons CSS link from the official CDN inside the <head> after the Bootstrap CSS link. Inside the <main>, add a heading <h1> with the text Our Features.
Bootsrap
Hint
Use the Bootstrap Icons CDN link from jsDelivr. Add the heading inside the main container.
3
Add an unordered list with features and icons
Inside the <main> container, below the heading, add an unordered list <ul>. Add three list items <li> with the texts: Fast Service, 24/7 Support, and Affordable Prices. Before each text, add a Bootstrap icon using <i> tags with these classes: bi bi-speedometer2 for Fast Service, bi bi-headset for 24/7 Support, and bi bi-cash-stack for Affordable Prices.
Bootsrap
Hint
Use the <i> tag with the correct Bootstrap icon classes before each feature text. Add aria-hidden="true" to icons for accessibility.
4
Improve alignment and accessibility
Add the Bootstrap class list-unstyled to the <ul> to remove default bullets. Wrap the icon and text inside each <li> with a <span> that has the class d-flex align-items-center gap-2 to align icons and text nicely with some space. Add aria-label attributes to each <li> describing the feature for screen readers.
Bootsrap
Hint
Use Bootstrap utility classes d-flex, align-items-center, and gap-2 on a <span> wrapping the icon and text. Add descriptive aria-label to each <li>.
Practice
(1/5)
1. Why is it important to use icons on a website?
easy
A. They help users understand content quickly and improve navigation.
B. They make the website load slower.
C. They replace all text on the page.
D. They only add decoration without any meaning.
Solution
Step 1: Understand the role of icons in user experience
Icons provide visual clues that help users quickly grasp the meaning of content or actions.
Step 2: Evaluate the options based on icon purpose
Only They help users understand content quickly and improve navigation. correctly states that icons improve understanding and navigation, while others are incorrect or misleading.
Final Answer:
They help users understand content quickly and improve navigation. -> Option A
Quick Check:
Icons improve understanding = A [OK]
Hint: Icons guide users visually, improving clarity and navigation [OK]
Common Mistakes:
Thinking icons only decorate without meaning
Believing icons replace all text
Assuming icons slow down websites significantly
2. Which is the correct way to include Bootstrap Icons in your HTML?
easy
A.
B.
C.
D.
Solution
Step 1: Identify how Bootstrap Icons are added
Bootstrap Icons are added by linking their CSS file in the HTML head using a <link> tag.
Step 2: Check each option's correctness
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css"> uses the correct <link> tag with the official CDN URL. Options B, C, and D are incorrect methods.
Final Answer:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css"> -> Option C
Quick Check:
Use <link> for CSS icons = A [OK]
Hint: Bootstrap Icons need a CSS link, not a script or image [OK]
Common Mistakes:
Using <script> instead of <link>
Trying to use image tags for icon fonts
Importing CSS incorrectly inside <style>
3. What will this HTML code display?
<i class="bi bi-alarm"></i> Alarm
medium
A. Only the word 'Alarm' without any icon.
B. An alarm clock icon followed by the word 'Alarm'.
C. A broken icon symbol and the word 'Alarm'.
D. Nothing, because the class is incorrect.
Solution
Step 1: Understand the icon class usage
The class "bi bi-alarm" is a valid Bootstrap Icon class for an alarm clock icon.
Step 2: Predict the rendered output
The <i> tag with this class will show the alarm icon, followed by the text 'Alarm'.
Final Answer:
An alarm clock icon followed by the word 'Alarm'. -> Option B
Quick Check:
Correct icon class shows icon + text = B [OK]
Hint: Valid 'bi bi-*' classes show icons before text [OK]
Common Mistakes:
Not linking Bootstrap Icons CSS, so icon doesn't show
Using wrong class names causing broken icons
Expecting icons without proper CSS inclusion
4. This code tries to add an icon but it doesn't show:
<i class="bi alarm"></i> Alert
What is the error?
medium
A. Bootstrap Icons require JavaScript to work.
B. The <i> tag cannot be used for icons.
C. The text 'Alert' must be inside the <i> tag.
D. The icon class should be 'bi bi-alarm', not 'bi alarm'.
Solution
Step 1: Check the icon class format
Bootstrap Icons require two classes: 'bi' and the specific icon name prefixed by 'bi-'.
Step 2: Identify the incorrect class usage
The code uses 'bi alarm' instead of 'bi bi-alarm', so the icon won't appear.
Final Answer:
The icon class should be 'bi bi-alarm', not 'bi alarm'. -> Option D
Quick Check:
Correct icon class format = D [OK]
Hint: Use 'bi bi-iconname' classes exactly for icons [OK]
Common Mistakes:
Missing the 'bi-' prefix on icon name
Using only one class instead of two
Thinking JavaScript is needed for icons
5. You want to add an icon with text that screen readers can understand. Which HTML snippet is best?
hard
A.
B. Success
C. Success
D.
Solution
Step 1: Understand accessibility for icons
Icons should have role="img" and aria-label to describe their meaning to screen readers.
Step 2: Evaluate each snippet for accessibility
<i class="bi bi-check-circle" role="img" aria-label="Success"></i> uses role="img" and aria-label="Success", making it accessible. <i class="bi bi-check-circle" aria-hidden="true"></i> <span class="visually-hidden">Success</span> hides the icon from screen readers, B puts text inside icon tag (not semantic), D lacks role attribute.
Final Answer:
<i class="bi bi-check-circle" role="img" aria-label="Success"></i> -> Option A
Quick Check:
Use role="img" + aria-label for accessible icons = C [OK]
Hint: Add role="img" and aria-label for screen reader friendly icons [OK]
Common Mistakes:
Hiding icon meaning from screen readers
Putting text inside icon tags
Omitting role="img" for icons
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.