CSS/Properties/font-family

From Web Education Community Group
Jump to: navigation, search

font-family

The font-family property value is a prioritized list of font family names and/or generic family names.

Description

Values [[ <family-name> | <generic-family> ] [, <family-name>| <generic-family>]* ] | inherit
Initial value Depends on user agent
Applies to All elements
Inherited Yes


Values

  • <family-name>
    The name of a font family of choice.


  • <generic-family>
    The following generic families are defined:
    • serif
    • sans-serif
    • cursive
    • fantasy
    • monospace


  • inherit
    Takes the same specified value as the property for the element's parent.


Example

Example A

[style.css]

#se {
  font-family: serif;
}
#sa {
  font-family: Gill, Helvetica, sans-serif;
}

[index.html]

<body>
  <p id="se">This is a paragraph(serif)</p>
  <p id="sa">This is a paragraph(sans-serif)</p></body>

Csslist2 font-family.png

CSS Reference

The CSS specification defines the font-family property in 15.3 Font family.