body {
background-color: silver;
color: white;
padding: 20px;
font-family: Arial, Verdana, sans-serif;
}
如上所示,多个 csv 字体 family
是什么意思?
最佳答案
这意味着如果客户端的浏览器没有可用的先前字体,字体将回退到列出的下一个字体。
通过列出多种字体,即使您列出的第一种字体在他们的浏览器中不可用,您也可以确保客户能够看到您想要显示的字体。
在你的例子中:
body {
background-color: silver;
color: white;
padding: 20px;
font-family: Arial, Verdana, sans-serif;
}
Arial
将回退到 Verdana
,后者将回退到 sans-serif
最佳实践:
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.
作为一个有趣的花絮,字体系列在 character by character basis 上可能很重要:
The font-family property specifies a list of fonts, from highest priority to lowest. Font selection does not simply stop at the first font named in the list that is on the user's system. Rather, font selection is done one character at a time, so that if an available font does not have a glyph that can display a character needed, the later available fonts are tried. However, this doesn't work in Internet Explorer 6 or earlier.
关于html - CSS 多字体系列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31447454/