Recommended HTML Usage
This part of the HTML Reference shows
recommended usage. These constructs are recommended because
- They conform to the SGML definition of HTML
- They are straightforward to implement
- They work on most existing browsers
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
consist of a HEAD element and a BODY element. The HEAD element
contains information global to the document, and the BODY contains a
flow of text and other elements.
See also: other legal
structures, tolerated
structural errors, severe
structural errors.
Head Elements
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 '<' or '&' 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 .
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 "<", ">", and "&" 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 are used to break the body into sections and subsections.
Several levels of headings are defined:
The BODY should begin with an H1 node that identifies the node in a
more local context than the TITLE.
H2 and H3 elements designate sections and subsections of a node.
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
- This is the first item of an unordered list.
- This is the
second item. It's kinda long, and should wrap around on most screens.
- This is the third item. It's only one paragraph, but it's got a
paragraph tag at the end.
- This is the fourth and final item.
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
Preformatted Text
The PRE 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 it appears in the
HTML source, 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)