CSS font-family Property

CSS font-family property specifies prioritized list of font family names or generic family names for an element.

CSS font-family property value must be enclosed in quotation marks.


The following table outline the usages and version history of this property.

Default value:

depends on the browser

Applies to: All elements
Inherited: Yes
Version: CSS1
JavaScript Syntax: object.style.fontFamily = "Arial, Helvetica, sans-serif"


Here is a syntax for the CSS font-family property

font-family: family-name | generic-family |initial | inherit;

Property Values

The following table describes the values of this property.

Value Description
family-name Specifies the prioritized list of font family name
For example, "Arial", Times" and "Helvetica" are font families
generic-family Specifies the prioritized list of generic font family name
For example, serif, sans-serif, cursive, fantasy, monospace are generic font families
initial Sets default value of this property
inherit Inherits this property from its parent element


The example below shows to sets line height such as normal, number, length, percentage values.

p.one {
  font-family: Arial, Helvetica, sans-serif;
p.two {
  font-family: "sans-serif", Arial, Helvetica;
p.three {
  font-family: Courier, Monaco, monospace;
p.four {
  font-family: "monospace", Monaco, Courier;

Run it...   »

Browser Compatibility

  • Google Chrome 1+
  • Mozilla Firefox 1+
  • Internet Explorer 4+
  • Opera 3.5+
  • Safari 1+

Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.