html - CSS 多字体系列?

标签 html css fonts

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/

相关文章:

java - 在 Swing 中使用印度语输入法输入文本时不显示英文字符

html - 使用 HTML 的 R Shiny 输出的属性

html - 如何解决底部 div 和顶部 div 固定位置的可滚动内容的透明度问题

html - 如何对齐 "Click here"旁边的图标?

css - 单击按钮时在按钮内显示加载栏

html - 如何更改html中的字体大小?

html - 我如何使我的链接的背景颜色与我的边框相匹配

html - 将 Logo 从右侧 Html CSS 移至中心

html - 我无法将我的背景图片从我的 FTP 上传到我的网站

android - 如何创建我的自定义三星 flipfont apk