Web Authoring: Formatting Tags

Formatting Tags


When the browser begins to format text in an HTML document, it lays out the text according to the information given to it by the tags. One side effect to this that people find disturbing at first is the fact that it ignores formatting information that isn't specified by tags.

In other words, it ignores the most obvious formatting information that you, as an author, see: the way the text is already laid out in front of you. It pays no more attention to the end of a line, for example, than to a space between words: as far as the browser is concerned, these are the same. It also ignores any apparent indenting or centering -- any number of spaces is equivalent to nothing more than a single space. Even the blank line between paragraphs is treated as nothing more than just a break between words.

This is similar to the "word-wrapping" feature in most word processors. The browser "wraps" the text to fit the space available. If two pieces of text represent separate paragraphs (and you would like them to look that way), then you have to tell the browser this, using (of course) a tag.

The tag used to do this is the P-tag we mentioned earlier. Notice that this tag does not represent the start of a paragraph, nor the end, but simply the break between paragraphs. Many people go overboard as soon as they learn about the P-tag: this isn't necessary. There are many cases where a P-tag isn't needed, because a paragraph break is already implied. One place where this is true is around section headings (we'll learn about the heading tags shortly). The P-tag is NOT a paired tag.

There's another, related tag, that's also useful: the BR, or line break, tag. This tag is used when you want a particular piece of text to start on a new line. For WordPerfect users, this is essentially the same idea as a "Hard Return." The BR tag is NOT a paired tag, either.

And if you want to really separate sections, you can use the HR, or "Horizontal Rule" tag. This draws a line between the pieces of text that it separates. Like the other two, this is an unpaired tag.

As a final note on formatting tags, there's the PRE tag (this one IS paired). The PRE tag indicates that a block of text is pre-formatted: in other words, the browser should break it up just exactly as it is, line breaks, paragraphs, indenting, and everything. This is useful for quickly getting in text that you don't have time to specify the formatting for. The down side is that the text looks awful (a sort of typewriterish look) and, more importantly, you can't include most other types of tags inside of a block of PRE-formatted text. But it makes a good tool for "rough draft" documents.


 Home  Next  Back
SDR, 11 Jun 1995.