Web Fonts

Using Google Fonts

Example

Load a font with a <link> (or @import), then use it in font-family:

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <style>
    @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap");
    body { font-family: "Poppins", sans-serif; }
    h2 { font-weight: 700; color: #04AA6D; }
  </style>
</head>
<body>

<h2>Poppins from Google Fonts</h2>
<p>Web fonts make a site look the same on every device.</p>

</body>
</html>

Result

@font-face

To host a font yourself, declare it with @font-face:

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap; /* show fallback text until the font loads */
}

Tip: Use WOFF2 files, load only the weights you use, and font-display: swap so text is never invisible.