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
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
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 .
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:
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
[email protected]
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.