Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS font-family property


May 05, 2021 CSS Reference Manual


Table of contents


CSS font-family property


The font of the specified paragraph:

p
{
font-family:"Times New Roman",Georgia,Serif;
}

Try it out . . .

Description of property definition and use

Font - Family properties specify the font of an element.

Font-family can save multiple font names as a "fallback" system. If the browser does not support the first font, the next one is tried.

There are two types of font family names:

  • family-name - The name of the specified family: the name of the specific font, such as "times," "courier," "arial."
  • generic-family - usually font family names: "serif," "sans-serif," "cursive," "fantasy," "monospace."

The use of a particular font family (Geneva) depends entirely on the availability of the font family on the user's machine; Therefore, it is highly recommended to use a generic font family name as a back path.

Note: Each value is separated by a comma.

Note: If the font name contains spaces, it must be quoted. Single quotes must be used when using the "style" property in HTML.

Default: not specified
Inherited: yes
Version: CSS1
JavaScript syntax: object .style.fontFamily="arial,sans-serif"


Browser support

The numbers in the table support the first browser version number of the property.

Attributes
font-family 1.0 4.0 1.0 1.0 3.5

The property value

Value Describe
  • family-name
  • generic-family

A priority table for a font family name or/and class family name for an element.

Default: Depends on the browser.

inherit The rule is that the font family should be inherited from the parent element.


Related articles

CSS tutorial: CSS Font

CSS Reference Manual: Font Properties