How to write a HTML-Document

How to write a HTML-Document

This text is mainly based on a talk I gave on the meeting of the Softwaregroup in Zeuthen at January 19th 1995.

There are a lot of documents about HTML on the WWW available. Therefore I will give only some basic information and some simple examples for giving you a quick start on writing HTML-documents yourself. There is already a quick start document in german by Helga Schwendicke. Those of you wich are already acquainted with HTML and are searching more information can refer to the following documents:

I just detected that there is the development of a WYSIWYG HTML-editor for X-Windows. Unfortunatly there is only an alpha-version by now and you have to install it yourself. I hope to install it one day ... There are some editors on other platforms. You can get information about these and other tools at CERN .

What is contained in this document?

The minimal HTML document

First of all, there ist a kind of frame wich is common to all HTML-documents. There are some parts, wich are redundant in the moment (for most WWW browsers respectively) and therefore not contained in every document, but may become important in the future of the WWW (some browsers resp.). Most of them are only redundant for backward compatibility, so one should include them in new documents in any case! The Frame looks like that:

Example 1


<TITLE> First Example </TITLE>

This is a text,
it is the text of the first example
of this HTML description.

Jan-19-95 Peter J. Weyers


If you want to have a look at the output, select this. If you are using Mosaic, you should first Clone a window and then click on the link, because then you can look at this document and the output of this examples at once.

Now, lets discuss the code. First of all, you will notice, that there are many words enclosed by angle-brackets "<" and ">". These are the commands of HTML. They are called "tags". There are pairs of tags, wich differ only by a slash as the first character of the second tag. These are beginning and end of "Elements" of the document, wich can be nested. E.g. the first tag is <HTML> and the last </HTML> wich means, that the element contained between these tags is a HTML-Document. As you see, the document is made of two major elements:

wich contains only the document title in this example.
wich contains the actual document, that is shown to the reader.
And contained in the BODY is
The ADDRESS element,
wich should clearly identify the author(s) of the document, meaning the responsible person(s) for that document, and as possible the date of its last modification.
The title of the document is in general not shown in the document field of the WWW-browser, but shows up e.g. in a hotlist or in a special "Document Title" field. WWW is working without those titles, but it is of course much more comfortable in many cases to have one, and therefore I recommend to put a title into every document as it is not much work.

The text wich is contained in the BODY element of the document is formated by the respective browser. This means on the one hand, that you do not know, when writing a document, how it might look like on some browsers and on the other hand that e.g. it does not matter if there is one space, several spaces or one or several linebreaks between two words, all this will be treated the same way. You may be used to the last if you are used to (La)TeX, but an empty line does not mean a new paragraph for HTML as for (La)TeX. As there are some special characters for HTML, they have to be described in some way, if you want them to show up in the document. The "<" and ">" characters can be described e.g. by &lt; and &gt; respectivly. Therefor "&" is again a special character wich can be described by &amp;.

The address should be given in any case as this is part of the "netiquette", the etiquette wich serves for some rules in the otherwise anarchic internet. It is recommended to include ones email address here (hence the tag-name "ADDRESS") or a link to a personal homepage, wich should contain the email address as well.

How to use an already existing ASCII text?

By now, you should be able to prepare a simple text for being included in our WWW-server. You might have some ASCII-Text, like minutes, wich you would like to be included in the WWW. Therfore it may be conveniant to keep the linebreaks, the empty lines, the indentations etc. as it is without writing an entirely new document for the WWW. You can achieve this by including your ASCII-Text between the tags "<PRE>" and "</PRE>" wich mean PREformatted. Althougt the special characters may show up as you want them to do, you should replace them as explained above for not getting unwanted results. Thera are two more elements wich may even be of interest, if you only include "ASCII-texts" into WWW:
The Headerline
This is a possibility to get a headerline wich differs in appearance from the text. This should not be used inside an PREformatted elementt, but can be used atop of it. The syntax is simply
<Hn> This ist the Headerline </Hn>
where n is a number from 1 (biggest headerline) to 6 (smallest headerline). Look at the primer by H. Schwendicke for an example of the output.
The Horizontal Rule
This is an horizontal rule wich seperates parts of the text like that:
This is done by the tag <HR>, obviously, there is