如何让 glyphicons 在 twitter-bootstrap 中工作?

How to get glyphicons working in twitter-bootstrap?

我在本地存储了 bootstrap 个文件:

<link rel="stylesheet" href="/bootstrap/3.2.0/css/bootstrap.min.css">

<script src="/bootstrap/3.2.0/js/bootstrap.min.js"></script>

但是当我这样做时:

<span class="glyphicon glyphicon-print" aria-hidden="true"></span>

我得到了一个小方块字符,例如当客户端没有正确的字体时显示的。我读到 here 有单独的 CSS,但是 link 坏了。有什么解决办法吗?

它没有问题。

<span class="glyphicon glyphicon-print" aria-hidden="true"></span>

http://jsfiddle.net/3v1tyL61/

找到了:

需要在本地创建:

/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.eot
/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.woff
/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.ttf
/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.svg

我从这里获取的:

http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.eot http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.woff http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.ttf http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.svg

Jonathan,在 bootstrap 下载文件中,您应该具有以下文件结构(除非您选择不将字形图标作为组件下载)

css -> bootstrap.css, bootstrap.css.map, bootstrap.min.css, bootstrap-theme.css, bootstrap-theme.css.map, bootstrap-theme.min.css
字体 -> glyphicons-halflings-regular.eot, glyphicons-halflings-regular.svg, glyphicons-halflings-regular.ttf, glyphicons-halflings-regular.woff, glyphicons-halflings-regular.woff2
js -> bootstrap.js, bootstrap.min.js, npm.js

如果您没有,我建议您前往 http://getbootstrap.com/getting-started/#download 并下载该软件包。将它链接到您自己的文件夹中很容易。只需将 Bootstrap CSS 文件夹重命名为 'Bootstrap' 然后将其拖到文件中的 CSS 文件夹(您可以直接获取文件,但文件夹为 CSS/Bootstrap/bootstrapCSSfiles 它只会使它更有条理。对 JS 和字体再次执行此操作,一切就绪。

祝你好运:D