我已经从 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>
不幸的是,当我查看页面时,我看到的就是这些
任何帮助都会很棒。谢谢
最佳答案
如果你想在 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/