When to use ‘Bad Tags’

HTML Icon

In XHTML there are a number of tags which have been dubbed ‘bad’ for being purely presentational. For a person that’s only beginning to learn the right way of writing HTML it’s a useful simplification to call these tags out of bounds. However, in most cases these tags do have legitimate use.

<i> and <b>

The tags with the least legitimate use, bold and italic are used where convention dictates there should be bolded or italicised text, but only if there is not another tag that covers this instance. An example of where one might use <i> is when writing the name of a ship. The ship’s name would conventionally be italicised, such as the HMS Hobart, but there is no tag for it.

There are tags for strong text (<strong>), emphasised text (<em>), quotes (<q> and <blockquote>), citations (<cite>), editorial insertions (<ins>), abbreviations and acronyms (<abbr> and <acronym>), sample output (<samp>), definitions (<def>), variables (<var>), text to be typed in by the user (<kbd>) and addresses (<address>) and probably a few others beside.

There aren’t many situations where <i> or <b> should be used, and they should be only considered where you are sure there isn’t a better option.

<br/>

The line break tag should only be used when line breaks are part of the actual information being presented. Examples include command-line output, street addresses and poetry.

If a ‘goblin (hob) waylays you,<br/>
Slice him up before he slays you.<br/>
Nothing makes you look a slob<br/>
Like running from a hob’lin (gob).<br/>

<hr/>

The <hr/> tag stands for ‘horizontal rule’, however, it’s meaning is a separator in text. If you’ve read a novel where the author switches between multiple story threads you’ve probably seen these. Maybe as a single star, maybe as a row thereof, maybe even as a horizontal rule. All of these would be <hr/>s in HTML.

The <hr/>’s use is to show where there is a clear change in the focus of the text. Such as where there is a change from the point-of-view from one person to another.

The name of the tag is a bad one, which is why in XHTML 2 it’s being changed to separator. Hell, if a page is being written in a top-to-bottom direction the ‘horizontal rule’ tag will be a vertical separator.

One Response to “When to use ‘Bad Tags’”

  1. Penny Says:

    Very informative post Adam! Cheers!

Leave a Reply

Avatars are handled by the Gravatar service