AGOCG logo
Graphics Multimedia VR Visualization Contents
Training Reports Workshops Briefings Index

Back Next Contents
Guide to good practices for WWW authors


Correct use of selected HTML tags

There are a number of standard HTML tags which are frequently misused, more often than not, in an attempt to exercise more control over layout.

Paragraph element

Paragraphs are opened with a <P> tag, and closed with </P>. This allows paragraphs to be formatted as a whole. Note that with earlier versions of HTML, <P> denoted a paragraph separator, but it has now been confirmed as an opening tag for the paragraph element, and hence requires the closing tag </P>.

One of the problems which HTML authors encounter is in manipulating or creating space in the document, and the <P> tag is often misused in an attempt to create extra spacing, for instance in multiples (most browsers will in any case ignore duplicate <P> tags), and before elements in which paragraph breaks are already implicit, such as:


Use the paragraph tag to enclose paragraphs, not to create space.


Headings

Headings are intended to define the structure of a document. They denote section headings and should not be used as a character formatting tool, for instance to force the use of a large font at a particular point in the document. Here is an example of the misuse of headings:

<H1>The beginning</H1>
Let's start at the beginning.
<H3>The next step</H3>
We move quickly through.
<H2>An important point</H2>
Something to be aware of as we move along ...

The 'important point' might well stand out, but this is not valid HTML.

Authors who bear in mind that the purpose of headings is to define the structure of a document will naturally follow this good practice:


Use heading levels in their natural order, starting with Heading Level 1 at the top of the document, and proceeding one step at a time from one level down to the next.


Lists

When using the definition (or glossary) list (DL), avoid using multiple DDs (definitions) for a term (DT), e.g.

<DL>
<DT>Citrus fruits
 <DD>Oranges
 <DD>Lemons
 <DD>Grapefruit
</DL>

A valid method for achieving the same effect is to insert several paragraphs (using the paragraph element <P>) within the one definition (<DD>).


Don't use multiple DD tags with one DT tag.


Overlapping and embedded tags

Unorthodox practices are likely to give unpredictable results on different browsers. For instance as in the following example:

<B>The use of <DFN>browser-specific extensions such as BLINK</B>
is not recommended</DFN>.

Avoid overlapping tags.


The HTML standard specifies which elements are allowed within others. For instance, using a header tag in the middle of a list is bad practice and it will certainly produce some strange distortions in index databases which collect data within header tags.


Do not embed structural tags in other elements such as lists or anchors.


For a detailed list of what can be embedded in what, refer to the A HREF="http://www.webtechs.com/sgml/html-2.0/html-2.0-index.html">HTML 2.0 DTD Reference.

Anchors

An anchor reference can be either a full URL (Uniform Resource Locator), or a Relative URL. The use of relative URLs for files in the same or adjacent directories on the same server is recommended. For example in making a link to a file explanation.htm in the parent directory of the current file's directory, rather than give the full path in the link, specify it in this way:

<A HREF="../explanation.htm">explain</A>

If you need to move your collection of data to a different location, it means that your links will not need to be changed.


Using relative URLs in anchors facilitates moving collections of data.


When giving a directory reference in a URL, include the trailing slash at the end,
e.g.

http://www.site.ac.uk/stats/

rather than

http://www.site.ac.uk/stats 

Cite URLs for directory entries correctly.


A directory reference will often lead to a specific file in that directory. For instance, many WWW servers are configured to point directory references to the file index.htm (or default.htm) in that directory.


Back Next Contents


MMI
February 1996

Graphics     Multimedia      Virtual Environments      Visualisation      Contents