|
font-family sets the over all font to use for the element. You can specify either a specific font, such as Helvetica or Arial, or a generic font-family. You can't tell which fonts will be available on the user's computer, so font-family allows you to list a series of choices, separated by commas. The web browser uses the first font in the list that it understands.
So, for example, the following code (in a STYLE tag or in a style sheet file) indicates that <H2 ...>Lucida Casual if that font is available. If it isn't, the browser should try Comic Sans MS.
H2
{
font-family:'Lucida Casual', 'Comic Sans MS';
}
which gives us this <H2 ...>
![]() Interpretations of the five generic font families. Only the first three are widely supported. |
![]() Serifs are small accentuations added to font characters to make them more readable. Fonts such as Times New Roman and Book Antiqua use serifs. Fonts that don't have serifs are often called "sans-serif" ("sans" is French for "without"). Arial and Helvetica are popular sans-serif fonts. |
Generic font families are all the font control you need in most situations. However, if you particularly want a specific font, the best technique is to combine named fonts with generic font families. For example, you could use several cursive style fonts, ending the list with the cursive generic font family:
H2.multi
{
H1 {font-family:'Brush Script MT',Phyllis,'Lucida Handwriting',cursive;}
}
which gives us an <H2 ...>
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.