Web4College

CSS font-family property

src

Description

CSS font-family property defines the types of font faces that vary in size and shapes.

There are only five generic families such as serif, sans-serif, cursive, fantasy, and monospace. But each generic family has many other families (family-name).

Syntax

font-family : list of family-names, generic-family

Property values

generic-family

serifDefault

The fonts that proportionaly-spaced and have thick or thin strokes than fonts.

font-family: serif;
Try it

sans-serif

sans-serif means without sharp strokes. The fonts that have plain stroke endings i.e. there are sharp or cross strokes.

font-family: sans-serif;
Try it

cursive

They are not formal type fonts. They look as if they have been written by a brush or hand.

font-family: cursive;
Try it

fantasy

fantasy fonts are more decorative and contain expressive representation of characters.

font-family: fantasy;
Try it

monospace

It looks like computer code. It represents text as if typed by a keyboard.

font-family: monospace;
Try it

list of families

We may use comma separated list of family names. This list should end up with a generic-family.


And if one family is not rendered by the browser, the next one will be used. If all the families are not rendered by browser, the generic-family must be used.

font-family: courier, monospace;
Try it

Applicable to

It applies to all elements