集册 Bootstrap 插件 Bootstrap Glyphicons

Bootstrap Glyphicons

Xebcnor     最近更新时间:2020-09-24 03:17:22

297

Bootstrap Glyphicons

目标

字体图标由于它的一些好处变得越来越流行了。在本教程中我们将讨论如何通过 Bootstrap 3 来使用和定制 Glyphicons。我们将解释在后台工作的 CSS 规则,这将让您更好的了解图标字体的工作原理。这样,您就能熟悉除了 Glyphicons 之外的任何图标字体设置。

什么是 Glyphicons

Glyphicons 是在 Web 项目中使用的图标字体。虽然,使用 Glyphicons 需要商业许可,但是您可以通过基于项目的 Bootstrap 来免费使用这些图标。为了表示对图标作者的感谢,希望您在使用时加上 Glyphicon 网站 的链接。

获取 Glyphicons

如果您已经从 https://github.com/twbs/bootstrap/releases/download/v3.0.2/bootstrap-3.0.2-dist.zip 下载 Bootstrap 3(或者任何版本 3 之前的版本),您可以找到 dist 文件夹内的 fonts 文件夹内的 glyphicons。这里有四个文件 - glyphicons-halflings-regular.eot、glyphicons-halflings-regular.svg、glyphicons-halflings-regular.ttf 和 glyphicons-halflings-regular.woff。相关的 CSS 规则写在 dist 文件夹内的 css 文件夹内的 bootstrap.css 和 bootstrap-min.css 文件上。

如何使用 Glyphicons

一般来说,我们可以得出通过 Bootstrap 3 使用 Glyphicons 的常见语法如下

<span class="glyphicon glyphicon-*"></span>

* 可以是任意代表特定图标的关键词。下面的实例演示了如何通过按钮使用它。

<button type="button" class="btn btn-primary btn-lg">
        <span class="glyphicon glyphicon-user"></span> User
    </button>

在线查看实例。

展开阅读全文