C & G web

Style Attribute : font-family

The font-family property is a prioritized list of font family names and/or generic family names for an element. The browser will use the first value it recognizes.

There are two types of font-family values:

  • family-name: The name of a font-family, like "times", "courier", "arial", etc.
  • generic-family: The name of a generic-family, like "serif", "sans-serif", "cursive", "fantasy", "monospace".

Note: Separate each value with a comma, and always offer a generic-family name as the last alternative.

Note: If a family-name contains white-space, it should be quoted. Single quotes must be used when using the "style" attribute in  HTML.


Example - Style Attribute : font-family

The font-family can be used to control the style of the text on your web page.

sans-serif

serif

cursive

fantasy

monospace


This can also be combined with controlling the colour, using the style attribute.

sans-serif Orange

serif Red

cursive Blue

fantasy Green

monospace Teal

The HTML

<html>

<head>
	<title>Style Attribute : font-family</title>
</head>

<body>

The font-family can be used to control the style of the text on your web page.

<p style="font-family : sans-serif;">sans-serif

<p style="font-family : serif;">serif

<p style="font-family : cursive;">cursive

<p style="font-family : fantasy;">fantasy

<p style="font-family : monospace;">monospace<br><br>

<hr noshade>

<p>This can also be combined with controlling the colour, using the style attribute.

<p style="font-family : sans-serif; color:Orange;">sans-serif Orange

<p style="font-family : serif; color : Red;">serif Red

<p style="font-family : cursive; color : Blue;">cursive Blue

<p style="font-family : fantasy; color : Green;">fantasy Green

<p style="font-family : monospace; color : Teal;">monospace Teal

</body>

</html>	
		

Previous page...

Back to Top of Page

Computeach International Ltd

Christopher Ward London Limited

Christopher Ward London Limited