Recommended HTML Usage

This part of the HTML Reference shows recommended usage. These constructs are recommended because This section contains many suggestions, rules of thumb, and the like. Where the suggestions are not equivalent to the DTD, the words "should," "may," etc. are linked to futher explanation.

Structure of an HTML document

An HTML document should start with a TITLE element.

If the document is searchable, an ISINDEX element should come next.

After any TITLE and ISINDEX elements comes the BODY, which should start with an H1 element, followed by other elements character data.

See also: tolerated structural errors, severe structural errors.

Header Elements

TITLE

The TITLE element should identify the document in a fairly wide context. Its content should fit on one line: it should be less than 72 characters with no linebreaks. It should not contain any '<' characters.

The title may be used to identify the node in a history list, to label the window displaying the node, etc. It is not normally displayed in the text of a document itself. Contrast titles with headings .

ISINDEX

The presence of the ISINDEX element indicates the document is searchable.

Body Elements

Within the content of these elements, the characters '<', '>', and '&' signal markup in many cases. They should be written as "&lt;", "&gt;", and "&amp;" respectively, to prevent this.

Anchors

A span of text can be marked as an anchor. Anchors can be used as the source of a hypertext link:

Choose this to view a neighbor document.

... or as the destination:

Fred Flinstone

See also: tolerated errors in anchors, severe errors in anchors.

Headings

Headings are used to break the body into sections and subsections. Several levels of headings are defined:

Level four headings are for sub-sub-sub headings

Paragraphs

Text that isn't marked up as some other element forms a paragraph.

Normal paragraphs consist of text consisting of words, sentences, and other stuff. Line breaks have no significance except to separate words. This is still the first paragraph of this section.

This is the second paragraph. Paragraphs are separated by P elements. HTML is relatively flat, and paragraph breaks are not allowed inside lists, headers, anchors, etc.

Lists

Glossaries

term
definition
another term
and its definition, which is long enough that it should wrap around on most screens.

Address

The address element indicates the author or source of the document:

DWC connolly@convex.com

TYPEWRITER

The TYPEWRITER element is used for characters that have already been formatted for a typewriter-like device. Markup is recognized in this element just as in the normal body paragraphs. But after processing tags and entity references, the data is displayed as on a typewriter, rather than using typesetting conventions.

Line breaks are significant, and characters are rendered in a fixed-width font to preserve horizontal formatting.

For example, a portion of a man page might look like:

NOTES cat is able to correctly access files larger that two giga- bytes in size. SEE ALSO cp(1), ex(1), more(1), pr(1), tail(1)

Literal Text Elements

XMP and LISTING

These elements are used when you want to type the characters into the source document and have them show up in the output just like you typed them.

These elements act much like the TYPEWRITER element, but because markup is not recognized in their content, some character sequences can't be represented (SGML end tags, for example.) On the other hand, you don't have to meticulously mark up all the special characters.

You can draw pictures /\ in example elements / \ see: \__/ This is literal text. THIS word should line up under THIS word. There should be exactly three blank lines between here and here. These elements are the source of the most errors in HTML implementations. They should be used only for simple examples that don't contiain SGML markup constructs.