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


当前回答

这个答案适用于任何使用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"));
}

其他回答

下面是我解决这个问题的方法。我在Firebug控制台中使用“坏URI”错误。图标显示为e# ##数字。我必须在“fonts”目录中添加一个.htaccess文件。 < FilesMatch " \。(ttf |传递|测试结束| woff) $ " > < IfModule mod_headers.c > 报头设置Access-Control-Allow-Origin "*" < / IfModule > < / FilesMatch > 可能的重复:firefox上可下载的字体:错误的URI或跨站点访问不允许

下载完整/非定制包从那里的网站和替换您的字体文件与非定制包字体。意志是固定的。

以下是官方文件中关于字体不渲染的说明。

更改图标字体位置 引导程序假定图标字体文件将位于../fonts/目录,相对于编译的CSS文件。移动或重命名这些字体文件意味着以以下三种方式之一更新CSS: 更改源Less文件中的@icon-font-path和/或@icon-font-name变量。 利用Less编译器提供的相对url选项。 修改编译后的CSS中的url()路径。 使用任何最适合您特定开发设置的选项。

除此之外,它可能是你错过了复制字体文件夹到根目录

正如@Stijn所描述的,当从Nuget安装这个包时,Bootstrap.css中的默认位置是不正确的。

将此部分更改为如下所示:

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

我必须创建一些重写条件来允许它们:

RewriteCond %{REQUEST_URI} !(^.+\.ttf)
RewriteCond %{REQUEST_URI} !(^.+\.eot)
RewriteCond %{REQUEST_URI} !(^.+\.svg)
RewriteCond %{REQUEST_URI} !(^.+\.woff)