CSS font-family Property


An element's font is specified by the font-family property. It can have multiple fonts as a backup system, so that if one font isn't supported by the browser, the other can be used. In other words, this property is used to specify the family-name and/or generic-family for the selected element based on the priority from the list.

The font-family is divided into two types:

  • family-name: It contains the name of a font-family, such as "times", "courier", "arial", and so on.
  • generic-family: It contains the name of a generic-family, such as "serif," "sans-serif," "cursive," "fantasy," and โ€œmonospace.โ€

Syntax

Example

Preview

Property Values

Value Description
family-name / generic-family A list of font family names and/or generic family names that have been prioritized.
initial This property is set to its default value.
inherit This property is inherited from its parent element.

Supported Browsers

Element Chrome Firefox Safari Edge / IE Opera
font-family 1.0 1.0 1.0 4.0 3.5