A tutorial on creating documents with HoTMetaL

©Copyright SoftQuad Inc., 1995. This document may be reproduced in whole or in part provided that this copyright notice is reproduced on each copy made.

If you're new to creating web (HTML) documents, you may want to follow this short tutorial. This tutorial aims to teach the fundamentals of HTML as well as the mechanics of using HoTMetaL. If you are not using HoTMetaL, we don't want to discourage you from reading this tutorial, but you should be aware that the instructions repeatedly refer to HoTMetaL commands.

You should open this document with the web browser of your choice, while simultaneously running HoTMetaL.

The tutorial covers the following topics:

  1. The basic document: titles, headers, and paragraphs.
  2. Character formatting: formatting inline text
  3. Block formatting
  4. Lists: ordered, unordered, and definition lists; changing the list bullets.
  5. Links and URLs: anchors, links within the same document, and images.
  6. Forms:
  7. Converting existing documents into HTML

The tutorials don't cover each topic exhaustively, but give you enough information for you to master a topic after obtaining additional details from the HTML Quick Reference which you'll find after the tutorial.

The first part of the tutorial may be used as a "quick start" that shows you how to create a file with HoTMetaL. When you've finished that section, you can continue with the other sections or, if you feel comfortable using or experimenting with HTML on your own, you can skip over the rest of the tutorial and refer to the HTML Quick Reference section when you need to find out something about HTML.

Getting started: a basic document

You will see a dialog box containing a list of elements that are valid at this point in the document. Elements are the "building blocks" of your document. Since the document is empty right now, any element is valid. However, we'll start by inserting the top-level element, which should be highlighted.

HoTMetaL now inserts an HTML element by inserting start-tag<HTML> and end-tag</HTML> icons. (Sometimes tags are called "commands", but this isn't really accurate.) HTML surrounds all the other elements in the document.

Notice that HoTMetaL has also inserted a HEAD element inside HTML, and a TITLE element inside HEAD. These elements are required in this context in the document. The insertion point is inside TITLE. The words "Document Title" are not part of the text of the document: this is a prefix which is for screen display only.

When you display this document in a browser, the contents of this element will be displayed in the title bar.

The main part of your document is the body, contained in the BODY element.

If you look at the Insert Element dialog box, you'll notice that you have many choices of elements to insert. However, it's normal to start your document with a heading. Web documents have six levels of headings, represented by the elements H1 through H6.

An H1 header will be used for major divisions in your document.

Now you're ready to insert some text.

You can begin smaller subdivisions of the document with lower-level ( H2 through H6) headings. You can skip levels if you want, but your documents will usually look better if you don't.

Now perhaps you'd like to see what this document will look like when it's published on the Web. But first, save the file:

HoTMetaL will invoke a browser displaying the file you're editing.

As we suggested at the start of this section, you may wish to skip directly to the HTML Quick Reference, or continue with the extended tutorial.

Character formatting: Adding emphasis to inline text

The techniques in this section are for formatting inline text--text that's embedded a paragraph or some other block of text. Techniques for formatting blocks are covered in the next section. In an HTML document, you add emphasis to a piece of text by surrounding it with an element. This is a little different from the approach of many word-processors, in which you would, for example, highlight a piece of text and choose a type style from a menu.

The list in the Surround dialog box gives all the elements that can surround the selection.

The selection is now surrounded by < I> and <I> tag icons, and, depending on which style sheet you've chosen, should be formatted in italic. In any case, a browser will format it in italic--you can use Preview to try this out.

Of course, you don't always have to surround the text after you've typed it--you can insert an I element with Insert Element... and just type the text between the tags.

For more information on character formatting, see the section Character formatting in the HTML Quick Reference.

Formatting blocks of text

There are several elements that you can use to surround parts of your document that require special formatting. For example, suppose you wish to add a block quote to the sample document you created above:

Notice that the text is indented slightly to set off the quotation. A browser will display a block quote with similar special formatting.

For more information on block formatting, see the section Block formatting in the HTML Quick Reference.

Lists

You can insert five different types of lists in your document.

Ordered (numbered) lists

Ordered lists are lists with numbered items. You don't have to add the numbers yourself--a browser will add these for you.

When you do this, HoTMetaL automatically inserts an LI (list item) element. With one exception, all lists consist of one or more LIs.

To really see how ordered lists work, you should preview the document:

As you can see, the browser has inserted the list numbers automatically

Unordered lists

An unordered list is one whose items aren't numbered, but instead start with bullets of some kind. Actually there are several kinds of unordered lists available to you: here we'll use the most common and general-purpose list element, UL (unordered list). In this section you'll also learn a new markup command.

The dialog box that appears is similar to the one you saw when you used the Insert Element... and Surround... markup commands. This time the list contains all the elements that can validly replace the current element. (The current element is OL.) Not surprising, your choices are all types of lists.

The OL start- and end-tags have changed to UL tags.

The browser now displays the list items with bullets rather than numbers.

You can nest lists by inserting a UL, OL, etc., inside a list item (LI). Some browsers will account for this by changing the list bullet for the nested list.

Definition lists

A third type of list is the definition list (DL). This list is different from the others because it doesn't consist of list item (LI) elements. Rather, it consists of a series of terms and definitions. As the name implies, this list is intended to display definitions, though you can use it for any list that requires two-part entries. When a definition list is displayed in a browser, a definition is typically displayed on a separate line from the corresponding term, and indented slightly.

The valid elements inside a DL are DT (definition term) and DD (definition). Although you're allowed to arrange them however you like, the normal ordering would be to have one DT (or more, if, for example, you are defining several words with the same meaning), followed by one or more DDs.

Now create two more definitions:

To see how this list is displayed in the browser:

Notice that the definitions are set off from the terms.

Changing the list bullets

(This section is an "aside": you don't have to complete it as part of the tutorial.)

You may have seen web documents that use list bullets with different sizes and colors than the browser normally displays. Some documents may even use graphics as list bullets. In general this effect is not achieved by using the usual list elements. Rather, such lists tend to be "manufactured" using elements that were not originally intended to be list elements.

For example, a list could be simulated as follows:

For each "list item" do the following:

Through experimentation (or web browsing) you can probably come up with other techniques for creating this kind of list.

Some browsers (though at the time of this writing, not many) will allow you to customize the style of list bullets associated with unordered lists (note that this must be done in the browser, not in HoTMetaL).

For more information on lists, see the section Lists in the HTML Quick Reference. To see examples of lists, you can use the Open Template... command to open the templates lolist.htm, lulist.htm, solist.htm, and sulist.htm.

Links and URLs

It is normal for HTML documents to contain links to other documents, which can be located anywhere on the WWW. These links are provided by Universal Resource Locators (URLs), which name the location and filename of a document, and the protocol used to access it.

Anchors

When you want to create "hot text" that someone can click on in a browser and cause a document to be accessed, you use an "anchor" (A) element.

The word "bibliography" is hot text. In a browser it will be displayed in a different color than surrounding text.

The second step in creating an anchor is creating the URL. A URL is not part of the content of the element, like hot text is. A URL is an attribute of the element.

This gives you a dialog box with entries (text boxes) for each of the attributes. Right now you need to work with only one of these.

The word "file" is a protocol (also called a "scheme"), which describes how the file referred to in the URL will be accessed by a web browser. You are using the file protocol because the file you're going to choose is on your local filesystem. If the document were on a web server, you would choose the protocol http.

The directory component of the URL is expressed in the "standard" format, which requires that the colon (:) be replaced by a vertical bar, and that directories be separated by slashes.

What this all means is, when someone clicks on the hot text (the word "bibliography") in a browser, the browser will attempt to locate the file (works.htm) referred to in the URL.

To see how this works, you should view the document in a browser:

The browser will now display the file works.htm.

Links within the same document

It's possible to make a link between two anchors in the same document. Then, when you click on one of the anchors (call it the "source") the browser window will scroll to the location of the other anchor (the "destination").

The dialog box that appears contains text boxes for each of the elements attributes, labeled with the attribute name.

You have just set up the "source" anchor. This is the URL for this anchor, even though it doesn't look like the URL you created in a previous part of this tutorial. Now you have to set up the "destination" anchor:

In this instance you're not going to create a URL for the anchor, rather, you're going to give this anchor a "name" by editing one of its attributes.

Now you're ready to see the effect of what you've just done.

The browser window will now scroll so that the location of the "destination" anchor is visible.

In general, you can set up a "source" and "destination" anchor pair by setting the NAME attribute of the destination anchor to `string' and setting the HREF attribute (i.e., the URL) of the source anchor to `#string'. This sets up a one-way link. You can set up a two-way link by editing the two anchors so that each one's NAME attribute corresponds to the other's HREF.

Images

Web documents often include graphical images. Images are inserted in a document using an element that is similar to the A element.

Now you are going to give the HREF attribute of the IMG element a value very similar to the first URL you created in the section on anchors. It will be the same except for the filename, which in this case is "author.gif". The URL will look something like this:

file:///c|sqhm/author.gif

When you do this, a graphical image will be displayed inline, in the HoTMetaL document window. (This is not really George Orwell, but another writer whose work you know if you're reading this manual.)

The inline image will be displayed in the browser, too.

See the section Link elements in the HTML Quick Reference for more information on images; in particular, you will find information on "hot images" and images with hot spots.

Forms

There are certain elements that a browser will display as graphical widgets, such as text boxes or drop-down list boxes, that can accept input from a user. A form in an HTML document is a set such elements that let the user enter some information and then call a program, located on a web server, that processes the information. For example, you could create a form that lets a user order a product that you're selling: you can set up the form so that when the user clicks on a "submit" button, the order is sent to your order-processing program.

To implement this, you have to:

  1. Create the form(s).
  2. Install on your server the program that will process the form's data.

The second of these two steps is beyond the scope of HoTMetaL PRO. You will have to obtain supplementary documentation that explains this mechanism, which is known as the CGI (Common Gateway Interface). If you open the file faq.htm in the directory where HoTMetaL is installed you will find a reference to a document on this topic.

This tutorial explains how to properly set up a sample form.

We've noticed that many browsers still have bugs in their support for forms. If something that you create in this tutorial doesn't look the way it should when you display it with your favorite browser, the problem may be with the browser. Of course, if you have a problem with forms that you can't resolve, feel free to contact our Technical Support department.

We suggest that for this exercise you create a new HTML document.

Actions

Now you're ready to start constructing a form.

This gives you a dialog box in which you will give a value for the ACTION attribute.

The "action" you've just specified refers to a program, located on SoftQuad's HTTP server, that can process the data entered in the form. At the end of the tutorial, you can submit the form to this program. In a "real-life" situation, you would probably specify a program on your own server, though in fact you can specify programs located anywhere on the Web.

mailto

Another action that you can use is mailto: this causes the form to be e-mailed to a specified address. (You can try this later: for the purpose of this tutorial, please use the action described above.)

To make use of mailto:

Some browsers do not support mailto. Also, in order for this feature to work if your system is behind a firewall, you may need to configure your browser to use the correct proxy server.

Creating a text box

Now you'll enter the first element that generates a graphical widget in the browser:

You can now preview the file to see what this looks like in a browser:

Notice that the browser has placed a text box next to the word "Name:".

You're not done with this INPUT element yet.

This brings up a dialog box that lets you edit the attributes of the current element.

This value is used when the browser sends the form's data to the server, in order to identify which text box, drop-down list box, etc., a particular piece of data came from.

Another attribute, SIZE, is used if you want to specify the text box's length in characters. If enter some text for the VALUE attribute, this text will be displayed in the text box by default.

Entering several lines of text

A text box in a form just lets you enter one line of text. If you need to allow your users to enter several lines of text at once (to enter an address, for example), you should use the TEXTAREA element.

If you want a TEXTAREA to contain some default text, enter it between the start- and end-tags.

Now you may want to see how the browser renders this object:

The browser generates a multi-line field, which may also have scroll bars.

Presenting a list of choices

Sometimes you will want the user to make one choice from a list of choices. In this example you'll see how to represent this with a pop-up menu.

HoTMetaL will ask you if you want to edit the attributes of this element.

The OPTION element represents one choice in the pop-up menu. The text you typed inside the element is a label that will appear in the menu.

To see what this looks like in the browser:

Notice that the text you typed inside each of the OPTION elements appears as labels on the drop-down list box.

When the form is submitted, the "value" associated with this list, which the browser sends to the server, will be the label of the list item that was chosen. You can override this by setting values for the VALUE attributes of the OPTION elements.

If you wanted, you could have represented this list of choices as a scrollable list rather than a drop-down list box. To do this, you would set the SIZE attribute to 2 or greater; this value would specify how many list items are shown at a time. If you want to be able to choose more than one item from this kind of list, set the MULTIPLE attribute to "MULTIPLE".

Just to complete this section of the form:

Check boxes

So far you have used the INPUT element only to represent text boxes. Actually, this element can be used for a variety of purposes. One of these is representing check boxes: you would use this kind of box if you wanted the user to make a "yes/no" choice. (This is different from a radio button , which you would use when you wanted the user to choose one from a group of choices.)

Now add two more titles in the same way:

To see what this looks like in the browser:

Try clicking on the buttons with the mouse. You can turn on all, any, or none of the buttons.

When the form is submitted, the default value associated with turned-on check boxes is the string "on" (turned-off check boxes are not submitted to the server). If you want to override this default, give values for the VALUE attributes of the INPUT elements. If you set the CHECKED attribute to "CHECKED", the corresponding check box will be turned on by default when the form is displayed in a browser.

Radio buttons

As we said above, you can also use the INPUT element to represent radio buttons. A group of radio buttons lets the user make one (and only one) choice from a group of choices.

Now add two more choices in the same way (keep all three choices in the same paragraph):

Notice the following things about the attribute values you've just entered:

  1. Each TYPE attribute is set to "RADIO". This tells the browser to generate a radio button.
  2. Each NAME attribute has the same value, in this case, "language". This causes all three radio buttons to be in the same group, which means that the browser will allow only one of these three to be checked at once. If the form contains another group of radio buttons, the NAME attribute for all of its members must be the same, but different from the value for the current group.
  3. The value of the VALUE attribute is sent to the server if the corresponding button is turned on when you submit the form, thus telling the server which button in this group was turned on.
  4. The first INPUT element in this group has the CHECKED attribute set to "CHECKED". This tells the browser that this button should be turned on by default when the form is first displayed.

To see what this looks like in the browser:

Try clicking on the buttons with the mouse. You can turn on only one of the radio buttons at a time. The button labeled "English" is initially turned on by default.

Reset

You can use the INPUT element to generate a button that restores all the form's controls (text boxes, radio buttons, etc.) to their default values:

To see what this looks like in the browser:

The form's controls revert to their default values. The text boxes are all blank and the check boxes are turned off. The radio button labeled "English" will be turned on.

Submitting the form

Your form is almost complete. All you need to do is create a button that causes the browser to submit the form.

To see what this looks like in the browser:

The form will now be submitted to a program on SoftQuad's web server. This program doesn't actually process an order, it just echoes back the information that the browser sent it. This information will appear in the browser window: you can return to the form by clicking on the button that takes you to the previous document.

The information is presented in pairs containing a "name" (corresponding to the NAME attribute of the text box, check box, etc.) and a "value" (for text boxes or "text areas ", this will be the data you typed in; for check boxes the value "on" is submitted--check boxes that aren't turned on are ignored; for radio buttons the value of the VALUE attribute is sent). You may notice a couple of unusual things about the format of the text: spaces are replaced by a `+' sign, and some special characters (notably newline, `=', and `&') are replaced by `%nn', where the n's are digits from 0-9 and/or letters between `A' and `F'. This is the standard form that browsers use for submitting data to the server.

Congratulations!

You've completed the tutorial and now (we hope!) understand the fundamentals of HTML. There's additional information in the HTML Quick Reference, e.g., different types of lists, emphasis elements, and block elements.

Converting existing documents into HTML

HoTMetaL PRO was not designed primarily as a document conversion tool. However, it is possible to employ it for this purpose. HoTMetaL does not perform auto-conversion: there are some commercially available filters that do.

Before you start

The file should conform to the following guidelines before you try to convert it.

When the file conforms to the above conditions, it's ready to be opened. Your first goal should be to insert basic markup so that you can take full advantage of HoTMetaL's context-sensitive rules checking. We suggest the following steps:

Now you can start to add more markup. It will probably make the file easier to work with, initially, if you do the following:

This will enable you see the line breaks in that were present in the original file.

The commands you will rely on most now are Surround... and Change....

Later you can add more complicated markup such as anchors and images. At any time, you can use Preview to see what the document looks like in a browser.

If you see something you like...

If you see a web page that contains a typographical effect, form, etc., that you like, then the easiest way of achieving the same thing yourself is to save the file with the browser (make sure you save it in HTML format) and then open it with HoTMetaL.

For further information...

The file faq.htm in the same directory as this tutorial contains titles and URLs for documents that contain information on HTML usage. Open this file with a browser and retrieve the documents that you're interested in.

A number of HTML tutorials, of varying quality, are usually available on the web. The relevant Usenet newsgroups (those in the comp.infosystems.www hierarchy) are also a source of information.