css字体系列问题,如果客户端不提供该字体怎么办 [英] css font family issue, what if the font is not available on client side

查看:226
本文介绍了css字体系列问题,如果客户端不提供该字体怎么办的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个网站托管在不同的服务器上,有些元素我设置了与'TheSans'相同的字体系列,我确信它们都不会被覆盖,'theSans'是CSS中的真实值和最终值,但是这两个页面的字体在同一浏览器中看起来却有所不同.我在电脑上检查后发现没有安装'theSans'字体,那么在那里实际发生了什么?

如果浏览器找不到字体,它将使用什么字体?为什么在同一浏览器中行为会有所不同.

解决方案

如果浏览器没有该字体,它将退回到css font-familyrule中指定的其他选项.如果未指定其他选项,它将仅使用其默认值.例如.在下面,如果已安装,它将使用Helvetica;如果未安装,它将使用arial;如果没有arial,它将仅选择其具有的所有sans-serif字体.

font-family: Helvetica, arial , san-serif;

有关字体家族的链接

现在这么说,如果没有的话,给浏览器一个字体会不是很好吗?这就是@ font-face CSS规则出现的地方

相关问题此处

关于@ font-face

I have two website hosted on different server, there are elements that i have set the same font-family as 'TheSans', I am sure they both are not overwritten, the 'theSans' is the real and final value in css, but the font of these 2 pages just look differently with same browser. I checked on my pc and found that I don't have this 'theSans' font installed, so what actually happened there?

if the browser does not find the font, what font it will use? why the behavior is different in same browser.

解决方案

If a browser doesn't have the font, it will fall back to the other options specified in the css font-familyrule. If no addition options are specified it will just use its default. eg. below it will use Helvetica if installed, if not it will use arial, if no arial it will just pick what every sans-serif font it has

font-family: Helvetica, arial , san-serif;

Link about font-family

Now that being said, wouldn't it be nice to give the browser the font if it doesn't have it? And that is where the @font-face CSS rule comes in

related question here

About @font-face

这篇关于css字体系列问题,如果客户端不提供该字体怎么办的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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