1. Home
  2. Computing & Technology
  3. Web Design / HTML

font-family

By Jennifer Kyrnin, About.com

font-family Description:

The font-family property defines the font family that the text should be displayed in.

font-family in CSS Versions:

font-family Syntax:

font-family: [[family-name | generic family-name],]* [family-name | generic family-name] | inherit

  • family-name
    The specific font family to be used.
  • generic family-name
    A generic font family that allows the user-agent to pick the most suitable match. Options are:
    • serif
    • sans-serif
    • cursive
    • fantasy
    • monospace
  • inherit
    The element should have the same font-family setting as the parent.

font-family Initial Value:

Depends upon the browser or user-agent. There is no standards defined initial font-family value.

font-family Applies To:

All elements.

font-family Inheritance:

This property is inherited.

font-family Browser Support:

font-family Examples:

Choose a single font for a paragraph

<p style="font-family : courier new;">
This paragraph is in courier new
</p>
Provide a list of similar fonts for the browser to use the first available
<p style="font-family : geneva, arial, helvetica, sans-serif;">
This paragraph would like to be geneva, but may be another sans-serif font.
</p>

font-family Special Notes:

  • Font families with whitespace in their names should be quoted.
  • If the computer viewing your page doesn't have the font specified, the browser will guess. This can cause strange effects. It is best to use standard fonts, or the generic font names.
  • When you use the generic font names, the computer will choose the font on the system most appropriate. Different Web browsers choose different fonts for the same generic font-family. Always test your page on different computers and different browsers.

More font-family Information

Return to the Style Library

Explore Web Design / HTML

More from About.com

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. CSS
  5. Style Properties
  6. CSS Style Property: font-family

©2008 About.com, a part of The New York Times Company.

All rights reserved.