我下载了引导3.0,但无法让象形文字工作。我得到一些"E003"错误。知道为什么会这样吗?我在本地和网上都试过了,还是遇到同样的问题。
当前回答
另一个问题/解决方案可能是使用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>
其他回答
这是由于bootstrap.css和bootstrap.min.css中的错误编码。当你从定制器下载Bootstrap 3.0时,以下代码是缺失的:
@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');
}
因为这是使用Glyphicons的主要代码,所以它不会在ofc…
从完整的包中下载css文件,这段代码将被实现。
在我的情况下,我得到了一个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
我必须创建一些重写条件来允许它们:
RewriteCond %{REQUEST_URI} !(^.+\.ttf)
RewriteCond %{REQUEST_URI} !(^.+\.eot)
RewriteCond %{REQUEST_URI} !(^.+\.svg)
RewriteCond %{REQUEST_URI} !(^.+\.woff)
如果你使用CDN作为引导CSS文件,它可能是罪魁祸首,因为字形文件(例如glyphicons-halflings-regular.woff)也是从CDN中获取的。
以我为例,我使用微软的CDN时遇到了这个问题,但切换到MaxCDN解决了它。
另一个问题/解决方案可能是使用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>