本文摘自PHP中文网,作者angryTom,侵删。

如果你想了解更多关于Bootstrap的知识,可以点击:Bootstrap教程
本篇文章将讲解字体图标(Glyphicons),并通过一些实例了解它的使用。Bootstrap 捆绑了 200 多种字体格式的字形。首先让我们先来理解一下什么是字体图标。
什么是字体图标
字体图标是在 Web 项目中使用的图标字体。虽然,Glyphicons Halflings 需要商业许可,但是您可以通过基于项目的 Bootstrap 来免费使用这些图标。
为了表示对图标作者的感谢,希望您在使用时加上 GLYPHICONS 网站的链接。
获取字体图标
在 fonts 文件夹内可以找到字体图标,它包含了下列这些文件:
●glyphicons-halflings-regular.eot
●glyphicons-halflings-regular.svg
●glyphicons-halflings-regular.ttf
●glyphicons-halflings-regular.woff
相关的 CSS 规则写在 dist 文件夹内的 css 文件夹内的 bootstrap.css 和 bootstrap-min.css 文件上。
用法
如需使用图标,只需要简单地使用下面的代码即可。请在图标和文本之间保留适当的空间。
1 | < span class = "glyphicon glyphicon-search" ></ span >
|
下面的实例演示了如何使用字体图标:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | < p >
< button type = "button" class = "btn btn-default" >
< span class = "glyphicon glyphicon-sort-by-attributes" ></ span >
</ button >
< button type = "button" class = "btn btn-default" >
< span class = "glyphicon glyphicon-sort-by-attributes-alt" ></ span >
</ button >
< button type = "button" class = "btn btn-default" >
< span class = "glyphicon glyphicon-sort-by-order" ></ span >
</ button >
< button type = "button" class = "btn btn-default" >
< span class = "glyphicon glyphicon-sort-by-order-alt" ></ span >
</ button ></ p >< button type = "button" class = "btn btn-default btn-lg" >
< span class = "glyphicon glyphicon-user" ></ span > User</ button >< button type = "button" class = "btn btn-default btn-sm" >
< span class = "glyphicon glyphicon-user" ></ span > User</ button >< button type = "button" class = "btn btn-default btn-xs" >
< span class = "glyphicon glyphicon-user" ></ span > User</ button >
|
结果如下所示:

带有字体图标的导航栏
阅读剩余部分
相关阅读 >>
Bootstarp的安装教程(详细)
bootstrap学习之表单格式与字体图标
bootstrap字体图标怎么使用
bootstrap怎么适配手机屏幕大小
更多相关阅读请进入《Bootstarp》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » bootstrap字体图标怎么使用