Specifying Alternate Fonts


While you can specify whichever font you want, your visitors will only see that font if they, too, have it installed on their computer. So, it's a good idea to use fonts that you can reasonably expect them to have.

If the font you want comes on both Mac and Windows, you can feel pretty safe simply specifying that font. If the font has different names on each system, you can specify both names and each OS will use the one it has installed. If the font you want only comes with one operating system, you can choose an alternate font for the other system, that may or may not match exactly. Finally, if the font you want doesn't come preinstalled on either computer system, you may want to specify alternate standard fonts for both operating systems.

Figure 10.5. The font-family property lets you include alternate fonts that the browser should use if the system does not have the first one installed. In this case, we can tell the browser to look for Palatino on systems that don't have Palatino Linotype installed.


To specify alternate fonts:

1.

After typing font-family:name as on page 152, type , name2, where name2 is your second font choice. Separate each choice with a comma and a space.

2.

Repeat step 1 as desired.

Figure 10.6. Systems that have Palatino Linotype installed will continue to use that font.


Tips

  • You can specify fonts for different alphabets in the same font-family rule (say, Japanese and English) to format a chunk of text that contains different languages and writing systems.

    Figure 10.7. Systems that don't have Palatino Linotype will use Palatino, as long as they have it (as most Mac systems do). If they don't have Palatino either, the browser will try the third choice. Note that the default line height is still different. We'll adjust this a bit later.

  • You can use the following generic font namesserif, sans-serif, cursive, fantasy, and monospaceas a last ditch attempt to influence which font is used for display.





HTML, XHTML, & CSS(c) Visual QuickStart Guide
HTML, XHTML, and CSS, Sixth Edition
ISBN: 0321430840
EAN: 2147483647
Year: 2004
Pages: 340

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net