What if your website text could always look great without you fixing fonts on every page?
Why Font family in CSS? - Purpose & Use Cases
Imagine you want your website text to look friendly and easy to read, so you pick a font like Comic Sans by typing it manually for every text element.
If you type the font name manually everywhere, you might make typos or forget to change it later. Also, if the font isn't available on a user's device, the text looks messy or unreadable.
The font-family property lets you list fonts in order of preference. The browser picks the first available font, so your text always looks good without extra work.
p { font: 16px 'Comic Sans MS'; }
h1 { font: 20px 'Comic Sans MS'; }body { font-family: 'Comic Sans MS', cursive, sans-serif; }You can easily control text style across your whole site and ensure it looks nice on any device.
A blog uses font-family to show a clean font on desktops but falls back to a simple font on phones that don't have the fancy one installed.
Typing font names everywhere is slow and error-prone.
font-family lets browsers pick the best available font automatically.
This keeps your text readable and your site looking consistent.