Glubase - share your knowledge


All / Computers / Programming / CSS





  • View Command

CSS Reference

CSS font-family definition

Browser support
IEFFOpSaf

Type:

Syntax

font-family: [<family-name> | <generic family,]* [<family-name> | <generic family>];

Description

The font-family property is a prioritized list of font family names and/or generic family names for HTML elements. The browser will use the first font in this list that is installed on the client machine.

Note: If a font name contains a space, then the font name must be quoted by a single or double quote.

Values

Any font-family names. For example: "arial", "courier", "times" and "helvetica"
Generic families: serif | sans-serif | cursive | fantasy | monospace

Inherited: Yes

Example

[Try this example yourself]
<p style="font-family: cursive;">Example text</p>

Output

Example text

Example

[Try this example yourself]
<style type="text/css">
  h1.sansserif {font-family: sans-serif, arial}
  div.courier {font-family: courier}
  div.serif {font-family: serif}
</style>

<h1.sansserif>
  Sans-serif header 1.
</h1>

<div class="courier">
  Courier division.
</p>

<p class="serif">
  Serif division.
</p>

Output

Sans-serif header 1.
Courier division.

Serif division.

  • Comments

No comments added.