Last modified Tue Jan 27 09:39:45 CST 1998
Since I teach a variety of people about HTML, I find it appropriate to keep
a simple reference to HTML handy, as much of the HTML documentation is
either unwieldy or outdated. For example, the HTML 3.0 documentation
runs over 190 pages, and the traditional HTML quick reference found
at http://kuhttp.cc.ukans.edu/lynx_help/HTML_quick.html still contains many
deprecated elements, such as <menu>.
Unfortunately, the time pressures of academic life have not given me sufficient opportunity to flesh-out all of this document. Nonetheless, both my students and I find it of some use, particularly in the electronic form.
HTML, the hypertext markup language is a common language for building hypertext documents for the World-Wide Web. Originally, authors had to build their documents in "raw HTML" because no tools were available. Now that such tools are available, many people no longer directly write HTML. Nonetheless, there a good reasons to learn HTML, particularly because it helps you understand what is and is not possible on the web.
More recently, other markup languages have been developed and extensions to HTML have been added. These other languages and extensions are not covered in this document (at least not yet).
Note that HTML is a markup language, not a programming language. What's the difference? A markup language indicates information about the structure of data; a programming language indicates information about the execution of a process (more or less).
In HTML, textual elements are traditionally surrounded by tags, although there are some tags that act as text elements. A piece of marked-up text looks something like
<TAG>some text</TAG>
In addition, certain tags may have attributes. For example, in NetScape's version of HTML, items in a list may indicate the type of mark that accompanies the item. In such cases, a piece of marked-up text looks something like
<TAG ATTRIBUTE_NAME=ATTRIBUTE>some text</TAG>
For example, one might indicate the title of a document with
<title>SamR's Quick HTML Reference</title>
Similarly, one might describe a table with a larger border with
<table border=10> ... </table>
Each HTML document is broken into two pieces:
As one might expect, the head is surrounded by <head> and
</head> tags, and the body is surrounded by
<body> and </body> tags. NetScape
extends the body tag with a background attribute. I
feel that this makes documents unreadable, but your mileage may vary.
In addition, the whole document should be surrounded by
<html> and </html> tags.
A basic HTML document might therefore appear as follows:
<html> <head> <title>A basic HTML document</title> </head> <body> This is the only line in the document. </body> </html>
<title>..</title> the
title of the document.
<link rev="made" href="mailto:...">
a link to the author of the document. There are other
link tags, such as to previous and next document.
This section needs to be expanded. More in HTML 3.0 specs.
<base>..</base> the
base name of the document; used for relative addressing.
<meta ...> a meta command,
most frequently used to embed http commands. For example,
<meta http-equiv="Refresh" content="1; url=nifty.left.html"> tells the browser to switch to another document after 1 second.
<p>..</p> a paragraph.
Need not have the </p> tag, in which case
<p> is treated as a paragraph separator.
<blockquote>..</blockquote> a quoted piece of text. I recall seeing that this may disappear.
<address>..</address> the address of the document author
<pre>..</pre> preformatted text. Usually presented in a monospace font.
HTML uses a hierachical heading system, with labels from
<h1> to <h6> Much of the documentation
suggests that you only use them in order. For example, you should always
begin your documents with an h1 tag and you should never use
an h3 tag without a surrounding h2 tag.
<em>..</em> emphasized
text.
<strong>..</strong>
more strongly emphasized text.
<code>..</code>
program code.
<i>..</i>
display text in italics. Not recommended..
<b>..</b>
display text in boldface. Not recommended..
<tt>..</tt>
display text in typewriter font.
<img src="URL">..</img>
alt="text" include alternate text to use
if the image cannot be displayed
align={top,middle,bottom} align the image relative
to the text.
<hr> a horizontal rule,
useful for separating sections.
<a href="URL">..</a> a link to another
document.
<a name="text">..</a> a named section
of the present document.
<a href="#text">..</a> a link to a named
section in the current document.
<a href="URL#text">..</a> a link to a named
section in another document.
<ol>..</ol>
an ordered list.
The elements of the list are numbered (or lettered or ...)
sequentially. NetScape extends this with various attributes.
<ul>..</ul> an
unordered list. The elements of the list are indicated with
some token. NetScape extends this with various attributes.
<li>..</li> an
element in an ordered or unordered list. NetScape extends this
with various attributes. The </li> is optional.
<dl>..</dl> a
definition list. Traditionally, a list of words and their
definitions. <dt>..</dt> the
definition term, the
object being defined.<dd>..</dd> the
definition.
<table>..</table>
delineate the table.
border=# determine the size of the border drawn
around the table
cellspacing=# spacing between cells
cellpadding=# spacing between contents and
data
width=# or width=#% the width
of the table.
<tr>..</tr> a row
in a table.
align={left,center,right} align data in cells
valign={top,middle bottom,baseline} align data
in cells
<td>..</td> a data
cell in a row of the table.
align={left,center,right} align data in cells
valign={top,middle bottom,baseline} align data
in cells
nowrap don't wrap the contents of the cell
colspan=# make a cell span multiple columns
rowspan=# make a cell span multiple rows
<th>..</th> a cell
used as a header in the table.
Attributes are as for <td>.
<caption>..</caption>
the caption of the table.
align={top,bottom} does the caption appear
above or below the body of the table
<!-- ... --> a
comment to the reader of the HTML file. Usually not interpreted by
the browser.
<br> force a break.
<!-- ... --> (comment)
<a ...> (an anchor or link).
<address> (the address of the author of the document)
<b> (boldface text)
<base> (base of document)
<blockquote> (a quotation)
<body> (body of HTML document)
<br> (break)
<caption> (caption of table)
<caption> (short amounts of program code)
<dd> (definition)
<dl> (definition term)
<dt> (definition list)
<em> (emphasized text)
<head> (head of HTML document)
<html> (HTML document)
<i> (italicized text)
<html> (include an image)
<li> (item in a list)
<ul> (ordered/numbered list)
<p> (paragraph)
<pre> (preformatted text)
<strong> (emphasized text)
<table> (table)
<td> (table data)
<th> (table header)
<title> (document title)
<tr> (table row)
<tt> (typewriter text)
<ul> (unordered/unnumbered list)
Samuel A. Rebelsky, rebelsky@math.grin.edu