One of my pet peeves of recent months is the use by many HTML authoring tools, and indeed some of those who construct their HTML by hand, of multiple <BR> tags to split text or a writeup into 'paragraphs'.

HTML is intended to be a structural markup language. Tags should identify the structure of a document, and the user agent, or browser should decide how this is to be displayed. Evidently, this doesn't work too well for things around here; we play with formatting for visual effects. But we shouldn't be entirely disregarding the rules, especially for elements as fundamental to our text as paragraphs.

Structurally, in HTML, a paragraph is enclosed with <P> tags. The user agent knows what to do with this: a visual agent like your browser will insert some vertical whitespace between successive paragraphs. A speaking browser will leave an appropriate pause. A typesetting agent might make pagination decisions based on paragraph length to avoid widows and orphans.

Let's take a brief look at how it should be done:

HTML source
<p>Paragraph 1.</p>
<p>Paragraph 2.</p>
Browser rendering

Paragraph 1.

Paragraph 2.

If the author of some HTML instead chooses to delimit their paragraphs with multiple line breaks, the notion of where the paragaph begins and ends is lost from the HTML. In most browsers, it probably looks the same, and 99% of users don't notice the difference.

HTML source
Paragraph 1.<br>
<br>
Paragraph 2.
Your browser's rendition of the above
Paragraph 1.

Paragraph 2.

Which is probably what the author intended. However, browser implementations do not necessarily have to insert two newlines just because there are two <BR> tags: the tag only 'ends the current line' (to quote directly from section 9.3.2 of the HTML 4.0 spec); with no text on a new line, there's sufficient scope for argument that multiple BR tags are ending the same line over and over, and no extra vertical whitespace need be inserted. On a browser (eg. lynx) which follows this argument, multiple <BR> tags will be treated as a single tag, and thus the above would be rendered as

Paragraph 1.
Paragraph 2.
Fairly innocuous in this trivial example, but when applied to a long pieces of text with long paragraphs, it reduces the display to a state of illegibility. Purely for the sake of an example, let's take the first part of this writeup and render it as lynx would if it were formatted with multiple BR tags...
One of my pet peeves of recent months is the use by many HTML authoring tools, and indeed those that construct their HTML by hand, of multiple <BR> tags to split text or a writeup into 'paragraphs'.
HTML is intended to be a structural markup language. Tags should identify the structure of a document, and the user agent, or browser should decide how this is to be displayed. Evidently, this doesn't work too well for things around here; we play with formatting for visual effects. But we shouldn't be entirely disregarding the rules, especially for elements as fundamental to our text as paragraphs.
Structurally, in HTML, a paragraph is enclosed with <P> tags. The user agent knows what to do with this: a visual agent like your browser will insert some vertical whitespace between successive paragraphs. A speaking browser will leave an appropriate pause. A typesetting agent might make pagination decisions based on paragraph length to avoid widows and orphans.
Let's take a brief look at how it should be done:

Not pretty is it? Or rather, it's even less pretty. The choice is clear, it's infinitely preferable to markup your text with the structural elements, at least for the body of writeups.

</RANT>

Also, multiple <BR> tags might not be what you want when you need to create large amounts of vertical space for effect, eg. on homenodes. A well-defined way of creating lots of vertical space is simply to use a bunch of blank lines inside <PRE> tags.

The E2 Text Formatter will, by default, do a very good approximation to The Right Thing with your HTML. Even though it's annoyingly unrepeatable, and written in Javascript.


Please note, if I've pointed you at this writeup because one of yours has <BR><BR> paragraph breaks, it's nothing personal. And there'll probably be an upvote in it for you if you fix it and get back to me -- I normally only bother about this when it spoils an otherwise good writeup.

Log in or register to write something here or to contact authors.