在流星中使用字体? [英] using font-face in meteor?

查看:21
本文介绍了在流星中使用字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在流星中使用 CSS @font-face,但由于某种原因它不起作用:

I am trying to use CSS @font-face in meteor, but for some reason it isn't working:

@font-face {
    font-family: printFailed; 
    src:
    url("../public/fonts/wlm_print_failed.ttf"),
    url("../public/fonts/wlm_print_failed.eot");
}

我检查了我的路径和拼写.

I've checked my paths and spelling.

当我在浏览器中检查元素时,文件路径和名称似乎是正确的,但浏览器正在替换通用字体而不是预期的自定义字体.

When I inspect the element in the browser it appears that the filepaths and names are correct, but that the browser is substituting a generic font instead of the intended custom font.

有什么指点吗?谢谢.

推荐答案

只需使用 / 因为 public 中的所有内容从网络的角度来看都成为根目录浏览器:

Just use / as everything in public becomes the root directory from the point of view of the web browser:

@font-face {
    font-family: printFailed; 
    src:
    url("/fonts/wlm_print_failed.ttf"),
    url("/fonts/wlm_print_failed.eot");
}

这篇关于在流星中使用字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆