我下载了引导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');
}
其他回答
我遇到了这个问题,它是由变量引起的。更少的文件。重写它以设置icon-font-path值解决了这个问题。
文件结构如下所示:
\Content
\Bootstrap
\Fonts
styles.less
variables.less
添加我自己的变量。在Content的根目录中添加less文件,并在样式中引用它。Less解决了404错误。
变量。不包含:
@icon-font-path: "fonts/";
下载完整/非定制包从那里的网站和替换您的字体文件与非定制包字体。意志是固定的。
读者注意:一定要阅读@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的自定义工具下载的字形字体文件与从bootstrap主页上的重定向下载的字体文件不相同。正常工作的是那些可以从以下链接下载的软件:
http://getbootstrap.com/getting-started/#download
任何对旧的糟糕的定制文件有问题的人都应该从上面的链接覆盖字体。
注意:下面可能是一个小众场景,但我想分享它,以防其他人可能会发现它有用。
在一个rails项目中,我们通过使用bootstrap-sass的rails引擎gem重用了很多东西。除了象形字体路径分辨率外,主项目中一切都很好。
GET http://0.0.0.0:3000/fonts/bootstrap/glyphicons-halflings-regular.woff 404 (Not Found)
我们发现$bootstrap-sass-asset-helper在解析期间为假,而我们期望它为真,因此路径不同。
我们在引擎gem中初始化了$bootstrap-sass-asset-helper:
// explicit sprockets import to get glyphicon font paths correct
@import 'bootstrap-sprockets';
@import "bootstrap/variables";
例如,这导致路径解析为:
/assets/bootstrap/glyphicons-halflings-regular.woff
同样,这在任何使用bootstrap-sass的正常rails项目中都不应该是必要的,我们只是碰巧重用了很多视图,这对我们来说很有效。希望这能帮助到其他人。
推荐文章
- Bootstrap抛出Uncaught错误:Bootstrap的JavaScript需要jQuery
- Twitter Bootstrap 3 Sticky Footer
- 大Glyphicons
- 引导3导航栏崩溃
- 改变引导弹窗的宽度
- 推特引导3.0我如何“徽章徽章重要”现在
- IE8问题推特引导3
- 多模态叠加
- 我如何使象形文字更大?(改变大小?)
- 如何增加列之间的间距?
- ' aria- labels by '和' aria-hidden '是什么属性
- 用Bootstrap 3在AngularJS中表示网格或表格的最佳方法?
- 引导3 jquery事件的活动标签更改
- 引导下拉子菜单缺失
- 引导4 -字形迁移?