当我 运行 在 bootstrap 3.2.0 上安装 bower 时,字形图标不起作用

Glyphicons don't work when I run bower install on bootstrap 3.2.0

我的字体文件夹中有以下内容:

(路径:C:\Users\smitha\Code\proj\bower_components\bootstrap\dist\fonts)

但是像 glyphicon-search 这样的字形没有加载!

 <div tabindex="6" class="glyphicon glyphicon-search">...<.div>

首先,您似乎没有全套字体文件。一套完整的应该包括以下5个文件:

  1. glyphicons-halflings-regular.eot
  2. glyphicons-半身人-regular.svg
  3. glyphicons-半身人-regular.ttf
  4. glyphicons-半身人-regular.woff
  5. glyphicons-halflings-regular.woff2

其次,除非您采取措施明确识别字体文件的位置,否则标准位置假定为 /fonts 文件夹,该文件夹与包含您的 bootstrap.js 的目录同级.例如,在您的帖子中使用 /fonts 目录的位置:

C:\Users\smitha\Code\proj\bower_components\bootstrap\dist\fonts

您的 Bootstrap JavaScript 图书馆应位于:

C:\Users\smitha\Code\proj\bower_components\bootstrap\dist\js\bootstrap-3.2.0.min.js

该文件夹是否实际命名并不重要/js;它可以被命名为任何东西;重要的是,它是 /font 文件夹的 同级 。您没有提到 Bootstrap 库的位置,但我猜它不在与您的 /font 目录同级的目录中。

如果这不能帮助您解决问题,您可能需要包含有关完整项目目录结构的更多信息,尤其是 Bootstrap JavaScript 库的位置。