HTML: The Definitive Guide

Previous Chapter 4 Next
 

4.5 Physical Style Tags

There are five physical styles provided by the current HTML standard for bold, italic, monospaced, underlined, and strike-through text. In addition, the advanced browsers already have implemented a few other physical style tags, some of which are part of the proposed HTML 3.2 standard, including superscripting, subscripting, big, small, and blinking text. All physical style tags require an ending tag.

The <b> Tag

The <b> tag is the physical equivalent of the <strong> content-based style tag, but without the latter's extended meaning. The <b> tag explicitly boldfaces a character or segment of text that is enclosed between it and its corresponding (</b>) end tag. If a boldface font is not available, the browser may use some other representation, such as reverse video or underlining.

The <big> Tag

The <big> tag is a Netscape-only HTML extension that makes it easy to increase the size of text without worrying about all of the details of virtual font sizes available with the <font> tag described below. It couldn't be simpler: Netscape renders the text between the <big> tag and its matching </big> ending tag one font size larger than the surrounding text. If that text is already at the largest size, <big> has no effect. [<font>, 4.6.3]

Even better, you can nest <big> tags to enlarge the text. Each <big> tag makes the text one size larger, up to a limit of size seven, as defined by the font model.

Careful with your use of the <big> tag, though. Because browsers are quite forgiving and try hard to understand a tag, those that don't support <big> often interpret it to mean bold.

The <blink> Tag

Text contained between the <blink> tag and its end tag </blink> does just that: blink on and off. Netscape for Macintosh, for example, simply and reiteratively reverses the background and foreground colors for the <blink> enclosed text.

We cannot effectively reproduce the animated effect here in these static pages, but it is easy to imagine and probably best left to the imagination, too. That's because blinking text has two primary effects: it gets your reader's attention, and then promptly annoys them to no end. Blinking text should be used sparingly in any context.

The <i> Tag

The <i> tag is like the <em> content-based style tag. It and its necessary (</i>) end tag tell the browser to render the enclosed text in an italic or oblique typeface. If the typeface is not available to the browser, highlighting, reverse video, or underlining might be used.

The <small> Tag

Netscape's <small> tag works just like its <big> extension (see above), except it decreases the size of text instead of increasing it. If the enclosed text is already at the smallest size supported by the font model, <small> has no effect.

Like <big>, you may also nest <small> tags to sequentially shrink text. Each <small> tag makes the text one size smaller than the containing <small> tag, down to a limit of size one.

The <s> Tag

The <s> tag is Internet Explorer's abbreviated form of the <strike> tag.

The <strike> Tag

Most browsers will put a line through (``strike through'') text that appears inside the <strike> tag and its </strike> end tag. Presumably, it is an editing markup that tells the reader to ignore the text passage, reminiscent of the days before typewriter correction tape. You'll rarely, if ever, see the tag in use today, but expect it to become more commonplace as marketeers of consumer items hawked on the Web slash prices on their slow-moving products.

The <sub> Tag

Like its <sup> counterpart (see below), the <sub> subscripting tag is not part of the HTML 2.0 standard, but is implemented in the latest versions of Netscape Navigator and NCSA Mosaic. The text contained between the <sub> tag and its </sub> end tag gets displayed half a character lower, but in the same font and size as the current text flow. Both <sub> and its <sup> counterpart are useful for math equations and in scientific notation.

The <sup> Tag

Mosaic and Netscape already support this proposed HTML standard (3.2) tag.

The <sup> tag and its </sup> end tag superscripts the enclosed text; it gets displayed half a character higher, but in the same font and size as the current text flow.

The <tt> Tag

In a manner like the <code> and <kbd> tags, the <tt> tag and necessary </tt> end tag direct the browser to display the enclosed text in a monospaced typeface. For those browsers that already use a monospaced typeface, this tag may make no discernible change in the presentation of the text.

The <u> Tag

This tag, supported by Mosaic and Internet Explorer, underlines the text contained between the <u> and the corresponding </u> tag. The underlining technique is simplistic, drawing the line under spaces and punctuation as well as the text.

Physical Tag Examples

The following HTML source example illustrates some of the various physical tags as rendered by Netscape for Figure 4-12:

Explicitly <b>boldfaced</b>, <i>italicized</i>, or
<tt>teletype-style</tt> text should be used 
<big><big>sparingly</big></big>.
Otherwise, drink <strike>lots</strike> 1x10<sup>6</sup>
drops of H<sub><small><small>2</small></small></sub>O.

Allowed Content

Any physical style tag may contain any item allowed in text, including conventional text, anchors, images, and line breaks. You also can combine physical style tags with other content-based ones.

Allowed Usage

Any physical style tag may used anywhere an item allowed in text can be used. In general, this means anywhere within a document except in the <title>, <listing>, and <xmp> tags. You could use a physical style tag in a heading, but the browser will probably override and ignore its effect in lieu of the heading tag.

Combining Styles

You probably will have better luck, Dr. Frankenstein, combining physical tags than you might have combining content-based tags to achieve multiple effects. For instance, Netscape renders the following in bold and italic typeface:

<b><i>Thar she blows!</i></b>

In practice, other browsers may elect to ignore such nesting: the HTML standard does not require the browser to support every possible combination of styles and does not define how the browser should handle such combinations. Although the extended browsers make a good attempt at doing so, do not assume that all combinations will be available to you.

Combining physical with content-based styles is not a completely bad idea, however. For instance, most browsers don't specially format definitions enclosed by the <dfn> tag because they don't support this as-yet-to-be-standardized content-based tag. Still, we argue you should use the <dfn> for its meaning more than its rendering style. To achieve the latter effect, consider adding italic physical tags to the definition segment. At worst, future browsers that support <dfn> will ignore the <i> tag. For example:

Kumquat: <i><dfn>A fruit some find delectable.</dfn></i>


Previous Home Next
Content-based Style Tags Book Index Expanded Font Handling
 


Banner.Novgorod.Ru