I know some basics of CSS and HTML and sometimes work with them, but am not a professional, and I'm curious about how Bootstrap Glyphicons work. I mean there are no images in the Bootstrap zip file, so where do the images come from?
相关问题
- How to add a “active” class to a carousel first el
- Full Clickable Accordion in Bootstrap
- How to add Bootstrap 4 without Tether?
- Laravel overriding bootstrap template
- How to add Labels to Bootstrap dialog footer
相关文章
- Make Bootstrap tab Active on the bases of URL link
- Rails: Twitter Bootstrap Buttons when visited get
- Reduce spacing between rows
- How do use bootstrap tooltips with React?
- Need to design 8 boxes in two rows
- Trigger a Bootstrap .collapse('toggle') vi
- How to override Bootstrap mixin without modifying
- Set border color to glyphicon
In Bootstrap 2.x, Glyphicons used the image method - using images as you mentioned in your question.
The drawbacks with the image method was that:
So instead of glyphicons in Bootstrap 2.x, a lot of people used Font-awesome, as this used SVG icons which did not have such limitations.
In Bootstrap 3.x, Glyphicons use the font method.
Using a font to represent an icon has advantages over using images:
You can see what you can do with the font method for icons here.
So in the Bootstrap distribution, you can see the glyphicon font files:
The Bootstrap CSS refers to the glyphicon font like so:
And the CSS links to this font using the
.glyphicon
base class (note thefont-family
):And then each glyphicon uses an individual icon class which refers to a Unicode reference within the Glyphicon Halflings font, e.g.:
This is why you must use the base
.glyphicon
class as well as the individual icon class against thespan
element in Bootstrap 3: