如何在CSS中使用外部字体? [英] How to use external font in CSS?

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

问题描述

我有一个HTML页面,使用字体 Tarminis 。这个字体安装在我的Windows字体文件夹中。所以如果我用Chrome打开页面页面是按预期呈现。但是,如果我用Firefox打开页面,它不能正确编码。

I have HTML page which uses font Tarminis. This font is installed in my windows fonts folder. So if I open the page with Chrome the page is rendered as expected. However, if I open page with Firefox it is not encoded properly.

所有数据都在此处: https ://dl.dropbox.com/u/72276354/snowbank.zip

不知怎么,Firefox(也是Opera)不能对括号内的文本进行编码。所以我想做的是把这种字体放在同一个文件夹中我的网页,并从那里加载。我一直试图使用CSS @ font-face 功能,但没有运气。

Somehow Firefox (also Opera) cannot encode text int the brackets. So what I wanna do is to put this font in the same folder with my webpage and load it from there. I've been trying to use CSS @font-face feature but with no luck.

强制我的网页使用 Tarminis 作为外部系统字体?

So how can I force my web page to use font Tarminis as external and not system font?

推荐答案

只需

@font-face {
        font-family: "Name of your font";
        src: url(name-of-font.tff);
}
* {
    font-family: "Name of your font";
}

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

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