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


当前回答

我使用VS2015, ASP。NET MVC 6 (RC),并且在生产(在VS(开发)中工作)中gliphicons也有问题(引用的错误消息,图标没有显示)。 原因似乎是,微软cdn页面关闭了(至少现在来自瑞士): http://www.websitedown.info/ajax.aspnetcdn.com

因此(作为临时解决方案),我已经改变了_Layout中的外部引用。cshtml(在环境名称下="Staging,Production")到"internal"引用: 来自:

<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.min.css"

to

<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css"

在此之后,它又可以工作了。

其他回答

如果其他解决方案不起作用,您可能希望尝试从外部源导入Glyphicons,而不是依赖Bootstrap为您完成所有工作。这样做:

你可以在HTML中这样做:

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">

或CSS:

@import url("//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css")

来自这个线程的信用edsiofi: Bootstrap 3 Glyphicons CDN

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

我也有同样的问题,除了在本页的隐藏评论中,我找不到任何关于它的信息。根据Chrome浏览器,我的字体文件加载正常,但图标显示不正常。我把这个作为答案,希望能帮助到其他人。

我从Bootstrap 3的定制工具下载的字体文件有问题。要获得正确的字体,请访问Bootstrap主页并下载完整的.zip文件。从那里提取四个字体文件到你的字体目录,一切都应该工作。

读者注意:一定要阅读@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的开发工具显示下载的字体在网络选项卡:

另一个问题/解决方案可能是使用Bootstrap 2。x代码:

<button class="btn" ng-click="open()"><i class="icon-calendar"></i></button>

当基于指南进行迁移时(。图标-*——> .glyphicon .glyphicon-*):

<button class="btn btn-default" ng-click="open()"><i class="glyphicon-calendar"></i></button>

你忘记添加图标类(包含字体引用):

<button class="btn btn-default" ng-click="open()"><i class="glyphicon glyphicon-calendar"></i></button>