CSS FONT FAMILY

In CSS, font-family specifies the font used for text.

body {
  font-family: Arial, sans-serif;
}

Common examples

p {
  font-family: "Roboto", sans-serif;
}

h1 {
  font-family: "Helvetica Neue", Arial, sans-serif;
}

p {
  font-family: Georgia, serif;
}

code {
  font-family: "Courier New", monospace;
}

Google Font example

body {
  font-family: "Poppins", sans-serif;
}

You first need to load the font, for example:

<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">

Then:

body {
  font-family: "Poppins", sans-serif;
}

Tip: Always include a fallback such as sans-serif, serif, or monospace after your preferred font.

Comments