我下载了引导3.0,但无法让象形文字工作。我得到一些"E003"错误。知道为什么会这样吗?我在本地和网上都试过了,还是遇到同样的问题。


当前回答

@font-face {
     font-family: 'Glyphicons Halflings';
      src: url('../fonts/glyphicons-halflings-regular.eot');
      src: url('../fonts/glyphicons-halflings-regular.eot?#iefix')         format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');}

我使用bootstrap命名空间和象形文字不工作,但在代码中添加上面一行象形文字工作正常。

其他回答

读者注意:一定要阅读@user2261073的评论和@Jeff关于定制器中的一个错误的回答。这可能就是你的问题所在。


字体文件没有正确加载。检查文件是否在预期的位置。

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url('../fonts/glyphicons-halflings-regular.eot');
  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');
}

正如丹尼尔所指出的,这也可能是一种mimetype问题。Chrome的开发工具显示下载的字体在网络选项卡:

我修改了较少的变量。更少的文件 我修改了变量

@icon-font-path:          "fonts/";    

最初的是

@icon-font-path:          "../fonts/"; 

这造成了一个问题

如果您正在使用CDN,请确保您使用的是最新版本的CDN链接。我正在使用CDN链接的前一个版本,并试图添加更新的图标,我在网站上找到(其中包含最新版本的图标),因此它没有显示在网页上。将cdn链接更改为最新版本可能会有所帮助。

如果你使用CDN作为引导CSS文件,它可能是罪魁祸首,因为字形文件(例如glyphicons-halflings-regular.woff)也是从CDN中获取的。

以我为例,我使用微软的CDN时遇到了这个问题,但切换到MaxCDN解决了它。

我有一个盒子宽度代码\e094用于象形文字箭头向下,事实上我解决了在CSS类中添加象形文字的问题:

<i class="glyphicon  glyphicon-arrow-down"></i>

如果它能帮助某人…