html – CSS多字体系列?

前端之家收集整理的这篇文章主要介绍了html – CSS多字体系列?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

body {
 background-color: silver;
 color: white;
 padding: 20px;
 font-family: Arial,Verdana,sans-serif;
}

当有多个csv字体系列时,它是什么意思,如上所述?

最佳答案
这意味着如果客户端的浏览器没有可用的先前字体,则字体将回退到列出的下一个字体.

通过列出多种字体,即使您列出的第一个字体在浏览器中不可用,您也可以确保客户端看到您要显示的字体.

在你的例子中:

body {
  background-color: silver;
  color: white;
  padding: 20px;
  font-family: Arial,sans-serif;
}

Arial将退回到Verdana,这将回归无衬线

最佳实践:

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.

原文链接:https://www.f2er.com/html/426560.html

猜你在找的HTML相关文章