亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Table of Contents
Option B: Install via npm (For modern web projects)
Option C: Download SVGs or Fonts (Manual control)
? 2. How to Use Bootstrap Icons
Method 1: Using the tag (Recommended for icons)
Method 2: With other elements
Method 3: Use individual SVG files (Best for performance & customization)
? 3. Customizing Icons (Size, Color, etc.)
Change size using built-in classes:
Change color with text utilities (if using Bootstrap CSS):
? 4. Tips & Best Practices
Home Web Front-end Bootstrap Tutorial How to install and use Bootstrap Icons library?

How to install and use Bootstrap Icons library?

Jul 27, 2025 am 01:25 AM

There are three ways to install and use Bootstrap Icons: 1. Use CDN and add links to the head of HTML; 2. Install through npm, suitable for modern projects such as React and Vue. You need to run npm install bootstrap-icons and import CSS; 3. Manually download SVG or font files and import them. When using it, you can add bi and icon name classes (such as bi-heart) to insert icons. You can also use other inline elements such as span. It is recommended to use SVG files for better performance and customization capabilities. You can adjust the size through bi-lg, bi-2x and other classes, and use Bootstrap text classes such as text-danger or custom CSS to modify the color. Best practices include: checking the official icon name, adding aria-hidden="true" to decorative icons, adding ARIA tags or sr-only text to semantic icons, which are lightweight and do not require Bootstrap framework support, and are suitable for any project.

How to install and use Bootstrap Icons library?

Installing and using Bootstrap Icons is simple and flexible — you can add them via CDN, npm, or download the files directly. Here's how to get started and use them in your project.

How to install and use Bootstrap Icons library?

? 1. Install Bootstrap Icons (Choose One Method)

You don't need the full Bootstrap framework to use Bootstrap Icons. Here are the most common ways to include them:

Option A: Use CDN (Fastest for basic use)

Add this <link> tag inside the of your HTML file:

How to install and use Bootstrap Icons library?
 <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css" rel="stylesheet">

? Best for quick prototypes or simple websites. No setup needed.

Option B: Install via npm (For modern web projects)

Run this command in your project directory:

How to install and use Bootstrap Icons library?
 npm install bootstrap-icons

Then, import the CSS in your main stylesheet or JS entry file (dependent on your build setup):

 @import "bootstrap-icons/font/bootstrap-icons.css";

? Best for React, Vue, or webpack-based apps.

Option C: Download SVGs or Fonts (Manual control)

Go to http://ipnx.cn/link/adad0f2b196a1ed3e3b9d9025c397132 , click "Download" or go to the GitHub repo ( http://ipnx.cn/link/16b872fc557900838e19f750151167e4 ) and download the icon files.

You can use individual SVGs or include the entire font set manually.


? 2. How to Use Bootstrap Icons

Once installed, you can use icons in several ways.

Bootstrap Icons use the bi class as base, followed by bi-icon-name .

 <i class="bi bi-heart"></i>
<i class="bi bi-arrow-right"></i>
<i class="bi bi-house-fill"></i>

Make sure to use the correct icon name from the official docs: http://ipnx.cn/link/adad0f2b196a1ed3e3b9d9025c397132

Method 2: With other elements

You can apply the classes to any inline element:

 <span class="bi bi-search"></span>

Useful when <i> doesn't fit semantic HTML standards.

Method 3: Use individual SVG files (Best for performance & customization)

If you downloaded or imported SVGs, you can use them directly:

 <svg class="bi" width="32" height="32" fill="currentColor">
  <use xlink:href="node_modules/bootstrap-icons/bootstrap-icons.svg#heart"/>
</svg>

This method is great for bundling and changing color/size via CSS.


? 3. Customizing Icons (Size, Color, etc.)

Change size using built-in classes:

 <i class="bi bi-star"></i> <!-- Default -->
<i class="bi bi-star bi-lg"></i> <!-- Larger -->
<i class="bi bi-star bi-2x"></i> <!-- 2x size -->
<i class="bi bi-star bi-3x"></i> <!-- 3x size -->

Change color with text utilities (if using Bootstrap CSS):

 <i class="bi bi-bell text-danger"></i>
<i class="bi bi-bell text-success"></i>

Or with custom CSS:

 .bi {
  color: #0d6efd;
  font-size: 2rem;
}

? 4. Tips & Best Practices

  • Always check the official icon library for correct names.
  • Avoid using many icons via SVG sprites if you're not bundling — it can slow down load time.
  • For accessibility, add aria-hidden="true" if the icon is decorative:
     <i class="bi bi-download" aria-hidden="true"></i>
  • If the icon conveys meaning (eg, "delete"), use proper ARIA labels or sr-only text.

  • Basically, just include the CSS and use bi bi-[icon-name] . It's lightweight, well-documented, and works anywhere — no framework needed.

    The above is the detailed content of How to install and use Bootstrap Icons library?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The Ultimate Guide to Creating Basic and Vertical Forms with Bootstrap The Ultimate Guide to Creating Basic and Vertical Forms with Bootstrap Jul 12, 2025 am 12:30 AM

The advantage of creating forms with Bootstrap is that it provides a consistent and responsive design, saving time, and ensuring cross-device compatibility. 1) Basic forms are simple to use, such as form-control and btn classes. 2) Vertical forms achieve a more structured layout through grid classes (such as col-sm-2 and col-sm-10).

Bootstrap Grid System vs Flexbox: what is better? Bootstrap Grid System vs Flexbox: what is better? Jul 06, 2025 am 12:42 AM

BootstrapGridSystemisbetterforquick,simpleprojects;Flexboxisidealforcustomizationandcontrol.1)Bootstrapiseasiertouseandfastertoimplement.2)Flexboxoffersmorecustomizationandflexibility.3)Flexboxcanbemoreperformant,butthedifferenceisusuallyminor.4)Boot

Bootstrap Grid System and accessibility Bootstrap Grid System and accessibility Jul 05, 2025 am 01:31 AM

TheBootstrapGridSystemcanbeoptimizedforbetteraccessibility.1)UsesemanticHTMLtagslikeandinsteadofgenericelements.2)ImplementARIAattributestoenhancescreenreaderfunctionality.3)ManagefocusorderlogicallywithBootstrap'sorderclasses.4)Useutilityclassesforp

Bootstrap Forms : Common errors Bootstrap Forms : Common errors Jul 14, 2025 am 12:28 AM

Bootstrapformscanleadtoerrorslikemisusingthegridsystem,improperformcontrols,validationissues,neglectingcustomCSS,accessibility,andperformance.Toavoidthese:1)Usecolumnclasseslikecol-sm-orcol-md-forresponsiveness;2)Wrapinputfieldsin.form-groupforproper

Bootstrap Navbar : How to use dropdown menus Bootstrap Navbar : How to use dropdown menus Jul 04, 2025 am 01:36 AM

The dropdown menu of BootstrapNavbar can be implemented through the following steps: 1. Use the dropdown class and the data-bs-toggle="dropdown" attribute. 2. Ensure responsive design. 3. Optimize performance. 4. Improve accessibility. 5. Custom style. This helps create a user-friendly navigation system.

Bootstrap Grid System: A Comprehensive Guide for Responsive Layouts Bootstrap Grid System: A Comprehensive Guide for Responsive Layouts Jul 12, 2025 am 01:23 AM

Bootstrap'sGridSystemhelpsinbuildingresponsivelayoutsbyofferingflexibilityandeaseofuse.1)Itallowsquickcreationofadaptablelayoutsacrossdevices.2)Advancedfeatureslikenestedrowsenablecomplexdesigns.3)Itencouragesaresponsivedesignphilosophy,enhancingcont

Bootstrap Navbar: What about Accessibility? Bootstrap Navbar: What about Accessibility? Jul 03, 2025 am 12:57 AM

BootstrapNavbarsaremoderatelyaccessiblebutrequireadditionaleffortforfullinclusivity.1)UseARIAattributeslikearia-labelonelements.2)EnsurekeyboardnavigationwithcustomJavaScriptforinteractiveelements.3)AdjustcolorcontrasttomeetWCAGstandards.4)Optimizepe

Bootstrap Grid System: A Beginner's Guide Bootstrap Grid System: A Beginner's Guide Jul 09, 2025 am 01:04 AM

Bootstrap'sGridSystemisessentialforcreatingresponsive,modernwebsites.1)Itusesa12-columnlayoutforflexiblecontentdisplay.2)Columnsaredefinedwithinrowsinsideacontainer,withwidthslikecol-6forhalf-width.3)Responsivenessisachievedusingclasseslikecol-sm-6fo

See all articles