Bootstrap Icons
Bootstrap Icons are a collection of ready-to-use icons that can be used in buttons, navigation menus, forms, alerts, cards and many other parts of a website.
1. What are Bootstrap Icons?
Bootstrap Icons is an icon library designed to work with Bootstrap and other web projects.
Icons can make a website easier to understand because users can quickly recognize common actions and features.
2. Installing Bootstrap Icons
Before using Bootstrap Icons, the Bootstrap Icons stylesheet needs to be included in the project.
CDN Example
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
3. Basic Icon
Bootstrap Icons are normally created using an
<i> element with the
bi class and the required icon class.
Example
<i class="bi bi-alarm"></i>
<i class="bi bi-house"></i>
<i class="bi bi-search"></i>
Output:
4. Commonly Used Icons
Bootstrap Icons provides icons for many common actions and interface elements.
Example
<i class="bi bi-house"></i>
<i class="bi bi-person"></i>
<i class="bi bi-gear"></i>
<i class="bi bi-trash"></i>
<i class="bi bi-download"></i>
Output:
5. Changing Icon Size
Bootstrap Icons can be resized using Bootstrap font-size utility classes or custom CSS.
Example
<i class="bi bi-star fs-1"></i>
<i class="bi bi-star fs-2"></i>
<i class="bi bi-star fs-3"></i>
Output:
6. Icons with Buttons
Icons can be placed inside Bootstrap buttons to make the purpose of the button clearer.
Example
<button class="btn btn-primary">
<i class="bi bi-download"></i>
Download
</button>
Output:
7. Icons with Text
Icons can be placed before or after text to provide additional visual meaning.
Example
<p>
<i class="bi bi-envelope"></i>
Email Us
</p>
<p>
<i class="bi bi-telephone"></i>
Contact Us
</p>
Output:
Email Us
Contact Us
8. Icons in Navigation
Icons can be used inside navigation links to make navigation items easier to recognize.
Example
<nav>
<a href="#" class="me-4">
<i class="bi bi-house"></i>
Home
</a>
<a href="#" class="me-4">
<i class="bi bi-book"></i>
Courses
</a>
<a href="#">
<i class="bi bi-person"></i>
Profile
</a>
</nav>
Output:
9. Icons in Alerts
Icons can make alert messages easier to understand.
Example
<div class="alert alert-success">
<i class="bi bi-check-circle"></i>
Registration completed successfully.
</div>
10. Icons in Forms
Icons can be used alongside form labels to provide additional visual meaning.
Example
<label class="form-label">
<i class="bi bi-person"></i>
Name
</label>
<input type="text"
class="form-control"
placeholder="Enter your name">
11. Icons with Lists
Icons can be used inside lists to visually represent each item.
Example
<ul class="list-unstyled">
<li>
<i class="bi bi-check-circle"></i>
Live Project
</li>
<li>
<i class="bi bi-check-circle"></i>
Internship
</li>
<li>
<i class="bi bi-check-circle"></i>
Interview Preparation
</li>
</ul>
- Live Project
- Internship
- Interview Preparation
12. Real-World CIIT Training Institute Example
Bootstrap Icons can be used on a training institute website to represent courses, contact information, learning features and actions.
Example
<div>
<p>
<i class="bi bi-book"></i>
Full Stack Development
</p>
<p>
<i class="bi bi-clock"></i>
Duration: 6 Months
</p>
<p>
<i class="bi bi-telephone"></i>
Contact CIIT Training Institute
</p>
<button class="btn btn-primary">
<i class="bi bi-arrow-right"></i>
Learn More
</button>
</div>
Output:
Full Stack Development
Duration: 6 Months
Contact CIIT Training Institute
Important Bootstrap Icon Classes
| Class | Purpose |
|---|---|
.bi |
Base Bootstrap Icons class. |
.bi-house |
Displays a home icon. |
.bi-search |
Displays a search icon. |
.bi-person |
Displays a person icon. |
.bi-gear |
Displays a settings icon. |
.bi-trash |
Displays a delete/trash icon. |
.bi-download |
Displays a download icon. |
.bi-check-circle |
Displays a check-circle icon. |
.bi-arrow-right |
Displays a right-arrow icon. |
.fs-1 |
Bootstrap utility for larger font size. |
Common Mistakes
- Forgetting to include the Bootstrap Icons stylesheet.
- Using an incorrect icon class name.
-
Forgetting the base
biclass. - Using too many icons and making the interface difficult to understand.
- Using icons without considering their meaning.
- Using icons without sufficient spacing from nearby text.
Summary
- Bootstrap Icons provide ready-to-use visual symbols.
-
The
biclass is used as the base icon class. -
Specific classes such as
bi-houseandbi-searchselect the required icon. - Icons can be used with buttons, navigation, forms, alerts and lists.
- Bootstrap font-size utilities can be used to control icon size.
- Icons should be used meaningfully so that they improve the user interface.