Does the CSS standard define mandatory fonts

67 views Asked by At

Does the CSS standard define any font set as mandatory? Just a theoretical question, I'm afraid, but something I've been wondering about.

What I mean, is if it doesn't, then a website that uses extremely common fonts like Times New Roman and Georgia, should ideally be importing those fonts from Google Fonts, or something similar.

Or, is it that we just provide generic names like - Serif, Sans Serif, etc and hope the browser defaults to an appropriate one.

EDIT: Just figured out, that the fonts I'm considering extremely common, are in fact, not free.

2

There are 2 answers

0
Quentin On BEST ANSWER

CSS defines a series of generic font families which are keywords rather than font names. Browsers are expected to map these onto appropriate fonts that are available on the local system.

  • serif
  • sans-serif
  • cursive
  • fantasy
  • monospace

The specification does not require than a specific font be made available for software to be considered CSS compliant.

1
Asons On

No, there is no mandatory font set, the browser will use the font installed on the device it runs.

It will parse the given font names, font-family: 'Times New Roman', Garamond, Serif, until it find one that match, and if not, it will try to pick one that best matches the one's set.

This is why, if you want make sure it looks how you want, you link/include the one's you need, where some can be used for free, some not

Note, as pointed out by Mr Lister, by adding the Serif last, and if none of the prior is found, it will look for a font having serifs