字体不适用于其他一些PC和iPhone?

Kas*_*ady 3 html css fonts

我的网站字体是font-family: Century Gothic;.

在我的电脑上它可以正常工作,但在其他电脑上它会被更改.

它也不适用于iPhone.

Jas*_*aro 5

发生这种情况是因为那些PC和iPhone没有安装字体.

如果要确保字体在尽可能多的计算机上运行,​​则应考虑使用@font-face.

基本的CSS语法是

@font-face{
    font-family: CenturyGothic;
    src: url('CenturyGothic.otf');
}
Run Code Online (Sandbox Code Playgroud)

然后

font-family: CenturyGothic, serif;  /* Whatever others you want to add */
Run Code Online (Sandbox Code Playgroud)

Six Revisions有一个很好的概述:http://sixrevisions.com/css/font-face-guide/

FontSquirrel将为您生成代码:http://www.fontsquirrel.com/fontface/generator

应该注意的是,除非字体是非商业字体,否则您将需要许可证才能使用它@font-face.也就是说,您需要购买字体,甚至可能购买分发它的权利.

(感谢@bookcasey强调需要添加此信息)

有关许可信息的良好资源是http://blog.themeforest.net/general/font-licensing-for-the-web/

话虽如此,有数千种免费提供的字体 - 包括FontSquirrel网站上的数十种字体 - 不需要许可.