我下载了引导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');
}
to
@font-face {
font-family: 'Glyphicons Halflings';
src: url('/assets/glyphicons-halflings-regular.eot');
src: url('/assets/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
url('/assets/fonts/glyphicons-halflings-regular.woff') format('woff'),
url('/assets/glyphicons-halflings-regular.ttf') format('truetype'),
url('/assets/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
其他回答
这就是在引导3中包含图标的方式
<span class="glyphicon glyphicon-bell"></span>
http://glyphicons.bootstrapcheatsheets.com/
希望这能有所帮助。
在我的情况下,我得到了一个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
如果有人在这里结束并使用引导>= v4.0:取消对字形的支持
发行说明中的相关部分:
删除Glyphicons图标字体。如果你需要图标,一些选项是: Glyphicons的上游版本 Octicons 字体太棒了
来源:https://v4-alpha.getbootstrap.com/migration/组件
如果你想使用象形文字,你需要单独下载。
我个人尝试过Font Awesome,它是相当好的。添加图标的方式类似于glypicon:
<i class="fas fa-chess"></i>
我也有同样的问题,除了在本页的隐藏评论中,我找不到任何关于它的信息。根据Chrome浏览器,我的字体文件加载正常,但图标显示不正常。我把这个作为答案,希望能帮助到其他人。
我从Bootstrap 3的定制工具下载的字体文件有问题。要获得正确的字体,请访问Bootstrap主页并下载完整的.zip文件。从那里提取四个字体文件到你的字体目录,一切都应该工作。
如果其他解决方案不起作用,您可能希望尝试从外部源导入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