Html Font-Family 属性中有多种字体?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6996632/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Multiple fonts in Font-Family property?
提问by Royi Namir
In the command
在命令中
<span style="font-family: arial,helvetica,sans-serif">
<font size="1">
[Country]
</font>
</span>
Why are there multiple fonts in the font-family
property?
为什么font-family
属性中有多种字体?
Does it mean that if the arial font is not installed so it will goto helvetica?
这是否意味着如果未安装 arial 字体,它将转到 helvetica?
回答by FogleBird
Yes.
是的。
The font-family property can hold several font names as a "fallback" system. If the browser does not support the first font, it tries the next font.
font-family 属性可以包含多个字体名称作为“后备”系统。如果浏览器不支持第一种字体,它会尝试下一种字体。
From: http://www.w3schools.com/cssref/pr_font_font-family.asp
来自:http: //www.w3schools.com/cssref/pr_font_font-family.asp
And as good practice:
作为良好做法:
Start with the font you want, and always end with a generic family, to let the browser pick a similar font in the generic family, if no other fonts are available.
从您想要的字体开始,并始终以通用系列结尾,以便浏览器在通用系列中选择类似的字体(如果没有其他字体可用)。
回答by S. Navarro
Yes, the font-family indicates the font priority. If the browser does not support the first font, it tries the next font. If the browser support arial, the style font will be arial. The browser use helvetica if does not support arial. You can use the name of a font-family (times, courier, arial, ...) or the name of a generic-family (serif, sans-serif, cursive, "monospace", ...).
是的,字体系列表示字体优先级。如果浏览器不支持第一种字体,它会尝试下一种字体。如果浏览器支持 arial,则样式字体将为 arial。如果不支持 arial,浏览器使用 helvetica。您可以使用字体系列的名称(times、courier、arial 等)或通用系列的名称(serif、sans-serif、cursive、“monospace”等)。