4.3 Changing Text Appearance and Meaning
A number of tags change the appearance of and associate hidden
meaning with text. In general, these tags can be grouped into two
flavors: content-based styles and physical styles.
In addition, the W3C standard for Cascading Style Sheets is now well
supported by the popular browsers, providing another, more
comprehensive way for authors to control the look and layout of their
document text. We describe the tag-based text styles in this chapter.
See Chapter 8 for details about CSS.
4.3.1 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. Note the distinction here.
Content-based style tags confer meaning, not formatting. Accordingly,
they are important for automated processes; machines
don't care what the document looks like.
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 current HTML and XHTML standards do not define a format for each
of the content-based styles; they only specify that they must be
rendered in a manner different from the regular text in a document.
The standards don'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.
4.3.2 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 some special way italic or bold, for
example 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 or XHTML you should avoid
physical tags except on rare occasions. 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.