HTML: The Definitive Guide

Previous Chapter 4
Text Basics
Next
 

4.3 Changing Text Appearance

HTML offers a number of tags that change the appearance of text. In general, these tags can be grouped into two flavors: content-based styles and physical styles.

In addition, the W3C has put forth a draft for a new standard way in which HTML authors may control the look and layout of their document text through Cascading Style Sheets. Netscape, too, in their latest browser has implemented style sheets through JavaScript. We describe the HTML tag-based text styles in this chapter. See Chapter 9, Cascading Style Sheets, for details about cascading and JavaScript-based style sheets.

Content-Based Styles

Content-based style tags inform the browser that the enclosed text has a specific meaning, context, or usage. The browser then formats the text in a manner consistent with that meaning, context, or usage.

Because font style is specified via semantic clues, the browser can choose a display style that is appropriate for the user. Since such styles vary by locale, using content-based styles helps ensure that your documents will have meaning to a broader range of readers. This is particularly important when a browser is targeted at blind or handicapped readers whose display options are radically different from conventional text or are extremely limited in some way.

The HTML standard does not define a format for each of the content-based styles except that they must be rendered in a manner different from the regular text in a document. The standard doesn't even insist that the content-based styles be rendered differently from one another. In practice, you'll find that many of these tags have fairly obvious relationships with conventional print, having similar meanings and rendered styles, and are rendered in the same style and fonts by most browsers.

Physical Styles

We use the word "intent" a lot when we talk about content-based style tags. That's because the meaning conveyed by the tag is more important than the way a browser displays the text. In some cases, however, you might want the text to appear explicitly in italic or bold, perhaps for legal or copyright reasons. In those cases, use a physical style for the text.

While the tendency with other text-processing systems is to control style and appearance explicitly, with HTML you should avoid explicit, physical tags except on rare occasions. Rather, provide the browser with as much contextual information as possible. Use the content-based styles. Even though current browsers may do nothing more than display their text in italic or bold, future browsers and various document-generation tools may use the content-based styles in any number of creative ways.


Previous Home Next
Headings Book Index Content-Based Style Tags

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell