CSS Font-family Property

Reference on the CSS font-family Property. Including background information and Example of use.

The font-family property is used to set the font family to be used on a page. It can both be used to set specific fonts, by using their exact name in quotes, or to set a family of fonts.

The first font found to be installed on a users system, will be the chosen one.

If font-family is used inside of the font-face rule, it will instead represent the remote font-name.

Possible Values

There are countless of fonts you can use, however they would need to be installed on your visitors system, before they would be able to view them. The generic font families are:

  • serif
  • sans-serif
  • cursive
  • fantasy
  • monospace

The font-family is a list of fonts, separated by comma; browsers will use the first font which is installed on the system. In addition, names containing whitespace should be quoted; and Font names should also be capitalized. I.E. "Times New Roman".

Font-family example

body {
  font-family: "Comic Sans MS", Arial, "Times New Roman", serif, sans-serif;
}

Inherited? - YES!

Post comment

Links that you insert are not nofollowed, but will be removed by admins if they are considered spam.

[url=Absolute URL for page]TITLE[/url]

You should insert code boxes around code examples, which will be automatically syntax highlighted.

[code1 html|css|javascript|php|sql]Your Code Here[/code1]

You may want to read our Privacy Policy before submitting your comment.