Everyday Computing Advanced Computing The Internet At Home Health, Mind & Body Making & Managing Money Sports & Leisure Travel Beyond The Classroom
Building Web Sites
Doing Business Online
Graphics & Animation
Using the Internet
Moms, Dads, and Grads -- Win $500!
XML All-in-One Desk Reference For Dummies
All in the Font Family
Adapted From: XML All-in-One Desk Reference For Dummies

Choosing a font for your display is among the most common of all formatting tasks, but it is also one of the trickiest. In order for the viewer of the document to see it in the font you chose, the desired font must first be installed on his or her computer. If that font is not available for the browser, the browser will substitute another similar style font.

Although the popularity of Windows machines have made it easier to pick fonts that most people will have on their machine, issues remain. Therefore, good forethought should go into your font decisions.

The font-family property is used to define the typeface of the element. It is a prioritized list of font "family" names and can be composed of specific fonts, generic font families, or both:

  • You can include the specific names of a font you wish, like this:

para { font-family: Times New Roman }

  • You can also include the names of generic font families, like this:

para { font-family: serif }

You will often want to use both specific and generic font family names in your list. Doing so enables the browser to try your preferred font choice first. If that choice is not available, it can continue down the list. Adding the appropriate generic name as a final entry ensures that at least the general style of the font will be used even if the desired typeface is unavailable. Suppose, for example, that you'd like to use the sans serif style Trebuchet MS font as your first choice for an address element, but you have a set of acceptable alternatives. Your rule would look something like this:

address { font-family: Trebuchet MS, Verdana, Tahoma, Arial, sans-serif }


To find out how to have Dummies eTips delivered to your e-mail inbox every week, visit the Dummies eTip Sign-Up Page.
Related Articles
Parsing XML Events with SAX
Building Custom Code with Java API for XML Binding (JAXB)
Observing Good Linking Practices
Saddling Up with HTML Horse Sense
Figuring Out What XML Is Good For
Related Titles
HTML, XHTML & CSS For Dummies, 6th Edition
Ajax For Dummies
HTML 4 For Dummies: Quick Reference, 2nd Edition
XHTML For Dummies
Java and XML For Dummies