To put it a little more clearly: the mechanisms for using a custom font on a website exist. They use the CSS 3 rule @font-face. They are more and more widespread especially thanks to Google Web Fonts, but not all browsers implement it in the same way. Read the article indicated in the previous paragraph for details. You can choose to visit https://ingramer.com/tools/fonts-generator/ for the best fonts.
The logic of using fonts on a website is as follows: we will tell the browser to use a font that is present on the user’s computer. Or rather, we will ask him to use a specific font, hoping that it will be available on the user’s computer, and if not to try a second, or even a third and a fourth, and finally if nothing works anymore the browser will have to use a “generic” font.
In CSS, it looks like this:
We call this accumulation of fonts by decreasing priority a collection of fonts or collection of fonts (in English: font stack). The number of fonts shown is free, it can range from zero to several dozen if desired but don’t overload your collections.
About the syntax used: the different fonts are separated by commas, and the font names are in straight quotes (or possibly in straight quotes) when they contain spaces.
Here is a concrete example:
The browser will first try to use Arial, then Helvetica if Arial is not available, and finally it will look for which font corresponds to the generic sans-serif.
What are generic fonts? Well, they depend on the configuration of the browser and the operating system.
Generic font collections
The problem with the above mechanism is that if we choose the wrong fonts from our collection, we can end up with two very different fonts from two different users. Three principles must therefore be respected:
Design should not rest on the shoulders of any particular font. You should test your pages by increasing the size of the text, and make sure that the rendering will be correct. Not necessarily ideal, but correct (layout that does not explode completely, content that is not hidden or overlapped by each other).
The key to doing this is making sure that everything that contains or nearly contains text is expandable in height. Use the property heightonly when it is really necessary, and not for convenience.
Fonts placed in a collection should be similar not only in style, but also in size, relative width of characters, etc. Be aware that for a given size (for example), two different fonts can have a variable size and occupy a variable space. Font-size:12px.
So placing Arial and Verdana in the same collection is a mistake: Verdana is taller and above all much wider. On the other hand, Arial is easily substituted for Trebuchet, although Arial’s style is noticeably different.
Popular fonts, widely used on users’ computers, will be used in priority. Most often, these will be fonts installed by default with operating systems, or installed with some popular software.
To detail this third and last principle would be tedious. Just know that the fonts we offer below have been established using the following criteria: