CSS multiple font families?

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

What does this mean when there is a multiple csv font families as above?

+4
source share
2 answers

This means that the font will revert to the next font if the client’s browser does not have a font available before.

By listing several fonts, you can make sure that the client sees the font that you want to display, even if the first font you specified is not available in the browser.

In your example:

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

Arialwill return to Verdanawhich will return tosans-serif

Best practice:

Start with the font you want and always end with a common family so that the browser can select a similar font in the generic family if there are no other fonts.

tidbit font-family :

font-family , . , , . , , , , , . Internet Explorer 6 .

+7

. "Sans-serif" - , , , sans-serif.

+2

Source: https://habr.com/ru/post/1598162/


All Articles