CSS Fonts

CSS fonts are used to control the appearance of text on web pages. CSS can be used to specify the font family, size, color, and other properties of text.

Font Family

The font family property specifies the font that will be used for an element. The font family can be specified as a single font name, a list of font names, or a generic font family.

For example, the following CSS rule will set the font family of all <h1> elements to “Times New Roman”:

h1 {
  font-family: "Times New Roman";
}

The following CSS rule will set the font family of all <h1> elements to a list of three fonts: “Times New Roman”, “Arial”, and “Verdana”:

h1 {
  font-family: "Times New Roman", "Arial", "Verdana";
}

The following CSS rule will set the font family of all <h1> elements to the generic font family “serif”:

h1 {
  font-family: "serif";
}

Task

Add the font-family property to both header and ul selectors, with the values ‘Arial’, sans-serif for header, and ‘Roboto’, sans-serif for ul. Run the code to see the results and experiment with the code to get used to it.

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT