A web font is a font file hosted on the web and loaded by a page through CSS, so visitors can see the intended typeface without installing it. The @font-face rule tells the browser where to find the files. Unlike system fonts, web fonts make the page’s typography more predictable across devices. section 18.2
Choose where the font files live:
- Use a third-party host such as Google Fonts, Fonts.com, or Adobe Fonts. These services generally handle font licensing and hosting, making setup easier. section 18.3
- Host the font files on your own site. This avoids relying on a remote font server, but requires managing the files and permissions yourself. section 18.2
- Remember the trade-off: remote fonts may add loading time, especially when many font files are linked, although major services optimize delivery. section 18.3
Load and apply a hosted font
Select the typeface and styles you need on the font host, copy its generated link tags into the page head before your own stylesheet, then apply the font in CSS. For example, load Lato and use it with a sans-serif fallback: p { font-family: Lato, sans-serif; } section 18.3
<link rel="preconnect" href="<a class="urlb" href="https://fonts.googleapis.com">https://fonts.googleapis.com</a>"> <link rel="preconnect" href="<a class="urlb" href="https://fonts.gstatic.com">https://fonts.gstatic.com</a>" crossorigin> <link href="<a class="urlb" href="https://fonts.googleapis.com/css2?family=Lato">https://fonts.googleapis.com/css2?family=Lato</a>:ital,wght@0,400;1,400;1,700&display=swap" rel="stylesheet">
Inspect the generated link tags that connect a page to Google Fonts and request regular, italic, and bold styles. section 18.3


