使用@ font-face使用多个自定义字体? [英] Use multiple custom fonts using @font-face?

查看:976
本文介绍了使用@ font-face使用多个自定义字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确定我错过了一些非常直接的东西。已使用具有正常字型面的单一自订字型:

I'm sure I'm missing something really straight forward. Been using a single custom font with normal font face:

@font-face {
    font-family: CustomFont;
    src: url('CustomFont.ttf');
}

当我使用它,但是如果我想添加另一个自定义字体我该怎么办?我尝试用逗号分隔下一个字体或添加一个整体其他字体,但不能让第二个字体工作。

All works fine when I use it but if I want to add another custom font what do I do? I've tried separating by comma the next one or adding a whole other font face but can't get the second font working.

推荐答案

p>您只需添加另一个 @ font-face 规则:

You simply add another @font-face rule:

@font-face {
    font-family: CustomFont;
    src: url('CustomFont.ttf');
}

@font-face {
    font-family: CustomFont2;
    src: url('CustomFont2.ttf');
}

如果您的第二个字体仍然无法使用,它的字体名称和它的文件名正确,你的浏览器缓存是行为,你的操作系统不会弄乱相同的名字的字体等。

If your second font still doesn't work, make sure you're spelling its typeface name and its file name correctly, your browser caches are behaving, your OS isn't messing around with a font of the same name, etc.

这篇关于使用@ font-face使用多个自定义字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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