Bootstrap Icons
Introduction
In this tutorial, you will learn how to use the Bootstrap 2.0 toolkit to create icons. Bootstrap icons are provided by Glyphicons. If you use these icons in your project, please make sure to provide Glyphicons link.
Used as CSS sprites
All icon images are bundled together and used through the background-position CSS propertyThe image file is glyphicons-halflings.png, located in the img folder under the Bootstrap main folder. The icon styles and background positions are specified at lines 1168 to 1544 of bootstrap.css. Note that to avoid conflicts, all icon classes are prefixed with "icon-". 120 icon classes are defined in Bootstrap 2.0.
How to Use Icons in Your Own Site or App
The following is the general syntax for using icons in a site or app:
where "icon_class_name" is the name of an icon class defined in bootstrap.css (for example: icon-music, icon-star, icon-user, etc.).
If you want to use white icons, add an additional icon-white class, as shown below:
If you want to include some text along with an icon, remember to add some spaces after it. This may occur when using icons in buttons or in some navigation links.
Example: A Search Form
Example
form {
margin-top: 50px;
}
View online
View the example above in different browser windows.
Example: Using Icons in Navigation
Example
View online
View the example above in different browser windows.
Example: Using Icons in Buttons and Button Groups
Example
form {
margin-top: 50px;
}
View online
View the example above in different browser windows.
Click here to download all the HTML, CSS, JS, and image files used in this tutorial.