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


当前回答

这就是为什么图标没有出现在我面前的原因:

* {
    arial, sans-serif !important;
}

在我已经删除了我的CSS的这一部分,一切都像它应该工作。重要的是引起麻烦的那个。

其他回答

我正在使用Angular2和SCSS,作为一个最佳实践,我复制到我的项目中,只有我正在修改的引导文件从node_modules导入。唯一的问题是glyphicon。 经过多次尝试,我发现对我来说最好的解决方案是复制字体文件到我的项目,并直接设置此路径为$ icon-font-path,如图所示:

这个答案适用于任何使用Nancy (Nancy fx)的人。

我有一个ASP。net托管的NancyFX应用程序,我通过NuGet获得了Boostrap。

我的字形不能工作,但事实证明不是糟糕的字体文件、不正确的CSS相对目录路径或其他答案中提到的任何其他事情的问题。

问题是我错过了一个惯例,告诉南希去哪里寻找内容。一旦我意识到这一点,解决方案就是简单地在我的bootstrapper文件中添加以下重载:

protected override void ConfigureConventions(NancyConventions nancyConventions)
{
    base.ConfigureConventions(nancyConventions);
    nancyConventions.StaticContentsConventions.Add(
        StaticContentConventionBuilder.AddDirectory("/fonts"));
    nancyConventions.StaticContentsConventions.Add(
        StaticContentConventionBuilder.AddDirectory("/Scripts"));
}

在我的情况下,我得到了一个404的glyphicons-halfling -regular。Woff,以及移动浏览器上不可见的象形文字。

看起来woff的MIME类型有些混乱,不同的浏览器接受多种MIME类型,但是W3C说:

application/font-woff

编辑:在测试以下MIME类型的woff作品目前在所有浏览器:

application/x-font-woff

编辑:目前Bootstrap的最新版本(3.3.5)使用。woff2字体,初始结果与。woff相同,W3C仍然在定义规范,但目前MIME类型似乎是:

application/font-woff2

您必须按以下顺序设置:

<link rel="stylesheet" href="path/bootstrap.min.css"> 
<style type="text/css"> 
     @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'); } 
</style>

例如,如果您希望图标为glyphicon-chevron-left

尝试添加class="glyphicon glyphicon-chevron-left"