Definition
The font-family CSS property is used to specify a prioritized list of font families to be applied to an HTML element. When rendering the text, the browser will select the first available font from the list.
If none of the specified fonts are available on the user’s system, the browser will use a default font instead. This property allows designers to ensure consistent typography across different platforms and devices.
And by the way, if you are looking for inspiration of different fonts to use on your project, check out this list of font families to explore!
p {
font-family: Arial, Helvetica, sans-serif;
}
In this example, the browser will first try to display the text inside a <p>
(paragraph) element using the “Arial” font.
If “Arial” is not available on the user’s system, the browser will attempt to use “Helvetica.” If neither “Arial” nor “Helvetica” are available, it will fall back to using the default sans-serif font on the user’s system.