html - 来自 fontello 的图标字体不适用于 Meteor js

标签 html css meteor icons fontello

我已经从 fontello 下载了自定义图标字体,并打算在我的 meteor 应用程序中使用它。 我尝试了下载包附带的演示,字体显示正常。这是我的 CSS:

@font-face {
 font-family: 'fontello';
 src: url('fonts/fontello.eot?98991264');
 src: url('fonts/fontello.eot?98991264#iefix') format('embedded-opentype'),
   url('fonts/fontello.woff?98991264') format('woff'),
   url('fonts/fontello.ttf?98991264') format('truetype'),
   url('fonts/fontello.svg?98991264#fontello') format('svg');
font-weight: normal;
font-style: normal;
}

[class^="icon-"]:before, [class*=" icon-"]:before {
 font-family: "fontello";
 font-style: normal;
 font-weight: normal;
 speak: none;
 display: inline-block;
 text-decoration: inherit;
 width: 1em;
 margin-right: .2em;
 text-align: center;

 /* For safety - reset parent styles, that can break glyph codes*/
 font-variant: normal;
 text-transform: none;

 /* fix buttons height, for twitter bootstrap */
 line-height: 1em;

}

.icon-twitter:before { content: '\e805'; } /* '' */
.icon-github-circled:before { content: '\e804'; } /* '' */
.icon-pencil:before { content: '\e801'; } /* '' */
.icon-cancel:before { content: '\e802'; } /* '' */
.icon-chat:before { content: '\e800'; } /* '' */

我的文件夹结构是这样的/client/css/styles.css和字体 /client/css/fonts/

在我的 html 中,我添加了这个标记 <i class="icon-twitter"></i>不幸的是,当我查看页面时,我看到的就是这些 enter image description here 任何帮助都会很棒。谢谢

最佳答案

如果你想在 your.domain.com/fonts/font_name.x 引用你的字体,你应该将你的 fonts 目录移动到标有 的目录公开。然后,您可以使用路径 /fonts/font_name.x 访问它们。

查看此处的非官方 Meteor 常见问题解答:https://github.com/oortcloud/unofficial-meteor-faq#where-should-i-put-my-files

public/ # <- static files, such as images, that are served directly.

或者直接看 Meteor 文档:http://docs.meteor.com/#structuringyourapp

Lastly, the Meteor server will serve any files under the public directory, just like in a Rails or Django project. This is the place for images, favicon.ico, robots.txt, and anything else.

关于html - 来自 fontello 的图标字体不适用于 Meteor js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16937918/

相关文章:

javascript - 如何对使用 javascript 中的循环创建的按钮使用相同的功能

javascript - 如何使用jquery或jsp检测系统上任何地方的按键和鼠标事件

html - 使用 CSS 背景拉伸(stretch)图像以填充背景

html - 当位置绝对时,Div child 不听 CSS

javascript - 登录后 meteor 重新渲染登录表单

html - CSS padding right 和 text-align right 在表格单元格中不能一起使用

javascript - 修复面包屑的响应性

html - 帖子的 CSS 网格布局而不是堆叠 (Hugo)

javascript - 防止 MeteorJS 集合中的口是心非(通过表单)

javascript - 为什么 meteor 不从我的模板助手中注入(inject)文本?