HTML Quick Reference
There are several levels or versions of HTML. Version 1.0 is the core set. This version contains all the text formatting commands you are likely to need. Version 2.0 adds forms so that you can get input back from the people who are reading your document. Version 3.0 adds better support for tables.
HTML 1.0 commands can be divided into 8 main categories. You do not need to use all of these categories. These commands are case-sensitive.
There is only one significant category of HTML 2.0 commands.
There is only one significant category of HTML 3.0 commands.
This reference is based upon the articles "An HTML Primer", "Tables for Your Home Page", and "Publishing HTML Forms on the Web" in the June 13, 1995, October 24, 1995, and December 5, 1995 issues, respectively, of PC Magazine.
<HTML>
<HEAD>
<TITLE>
Window Title Text
</TITLE>
</HEAD>
<BODY>
Document content text...
</BODY>
</HTML>
Note that the "Window Title Text"
will appear in browser window title bar.
You will likely want to repeat the title as a header in the body of the
document.
The <P> command ends a paragraph.
You can also use this command to force extra vertical space.
You do not need to use this if your text is followed by a header.
The <BR> command ends a line without ending a paragraph.
This is how you force a newline in a formatted section of text.
The <HR> command draws a horizontal rule across the page.
It has the added effect of acting like a <BR>.
The <PRE> and </PRE>
commands are used to surround preformatted text which you do not want to
be automatically justified.
This can be used to present tabular information.
The <LISTING> and </LISTING>
commands are very similar to the
<PRE> and </PRE> commands.
Listing denoted text is considered to be some type of source code listing.
As such, a browser may display it differently from preformatted text.
The <BLOCKQUOTE> and </BLOCKQUOTE>
commands are also very similar to the
<PRE> and </PRE> commands.
Blockquote denoted text is typically displayed with indentation and
extra white space.
Heading Commands
Six levels of headings are supported.
As is standard with denoted text,
the commands must be used in pairs.
The following code:
produces this result:
<H3>This is a level 3 heading</H3>
<H4>This is a level 4 heading</H4>
<H5>This is a level 5 heading</H5>
<H6>This is a level 6 heading</H6>
<B>bold text</B>
<I>italic text</I>
<U>underlined text</U>
<TT>teletype (non-proportional) text</TT>
<ADDRESS>an address</ADDRESS>
<CITE>a citation</CITE>
a code fragment is produced via
<CODE>a code fragment</CODE>
<DFN>a definition</DFN>
<EM>an emphasis</EM>
<KBD>a keyboard fragment</KBD>
<SAMP>a sample output</SAMP>
<STRONG>a strong emphasis</STRONG>
<VAR>a program variable</VAR>
One additional format is the comment form.
Anything between a <! and the corresponding closing
> is ignored by browsers.
List Commands
Three different kinds of formatted lists are supported:
ordered lists, unordered lists, and definition lists.
Sequential numbering is automatically applied for numbered lists.
Unordered lists have a bullet tag per item.
Definition lists provide dictionary like formatting.
All of these are best illustrated by example.
Note the use of
<LI> in ordered and unordered lists to denote the items.
In definition lists,
<DD> and <DT>
are used instead to denote the term and its definition, respectively.
<OL>
<LI>First item
<LI>Second item
<LI>Third item
</OL>
produces
<UL>
<LI>First item
<LI>Second item
<LI>Third item
</UL>
produces
<DL>
<DT>First term
<DD>First definition
<DT>Second term
<DD>Second definition
<DT>Third term
<DD>Third definition
</DL>
produces
& displays as &
< displays as <
> displays as >
" displays as "
< displays as <
> displays as >
& displays as &
" displays as "
© displays as ©
® displays as ®
<IMG SRC="URL" [ALIGN=TOP|MIDDLE|BOTTOM] [ALT="text"]>
The URL for the image may be relative or absolute.
Typically, you would either have your images in the same directory as your
HTML text
or an an images subdirectory.
Files using the .gif format are common and are supported by
all browsers.
The ALT parameter specifies text to be used in place of the image
(such as for text-only browsers).
If you do not have your image separated from your text (such as via a
<BR> or <P>), part of a line of
text will be associated with the image. See the image at the start of this
document as an example.
The ALIGN parameter controls the vertical position of
the text relative to the image.
Please try to keep your graphic images under 20K in size
to account for those who are using lower bandwidth links.
Anchor Commands
These commands are either the starting point of a hyperlink
or the target of a hyperlink.
This is done by use of a tag of the form:
<A HREF="URL#label">some text</A>
Again the URL for the image may be relative or absolute.
(Ignore the #label part for now.)
The text after
the URL can even contain an IMAGE tag.
The text can even be omitted and replaced by just an IMAGE tag.
An extension of this type of tag allows one to set up scrolling marks within the existing document. At least two tags must be set up: the one which gets you to the destination, and the one marking the destination. These take the form:
<A NAME="label">some text</A>
<A HREF="#label">some text</A>
Finally, you can even combine the HREF and NAME
forms to provide a way to move from one scrolling mark to another.
This document uses this feature to provide quick access to topics from
the initial introduction.
<TABLE> and </TABLE>
commands are used to surround the tabular data.
Tables can be nested within other tables.
You can use
<TABLE BORDER> in place of </TABLE>
to have borders around the cells of the table.
The
<CAPTION> and </CAPTION> tags
can be used to add a caption to a table.
Place this sequence just after the opening
<TABLE> tag.
You can add an ALIGN=TOP|BOTTOM parameter within the
<CAPTION> tag to control the placement of the caption.
Within a
<TABLE> tag pair,
each row is delimited by
<TR> and </TR> tags
and each cell within a row is delimited by
<TD> and </TD> tags.
Headings are similar to data cells, except the tags are
<TH> and </TH>.
An example is in order.
The sequence
produces
<TABLE BORDER>
<CAPTION ALIGN=TOP>Example Table</CAPTION>
<TR>
<TH>Column Heading 1</TH>
<TH>Column Heading 2</TH>
</TR>
<TR>
<TD>1st cell text</TD>
<TD>2nd cell text</TD>
</TR>
</TABLE>
| Column Heading 1 | Column Heading 2 |
|---|---|
| 1st cell text | 2nd cell text |
The Text Flow, Heading, and Character Formatting commands can all be used within a table cell. Even Inline Graphics and Anchor commands can be used within a cell.
To provide additional control over the format of the text within a cell,
three additional tag modifiers are available.
Each of these modifiers may be used with the
<TH>,
<TR>, and
<TD> tags.
If one of these modifiers is used in a
<TR> tag,
the modification will be applied to all cells in that row.
A modifier in a
<TD> tag
will override a modifier in an enclosing
<TR> tag.
The first of these modifiers is NOWRAP.
This modifier turns off automatic text reflow within a cell.
As this limits a browser's ability to adjust the display of the table,
use of this modified is discouraged.
The other modifiers are
ALIGN=LEFT|CENTER|RIGHT
and
VALIGN=TOP|MIDDLE|BOTTOM|BASELINE.
These modifiers control the horizontal and vertical placement of text,
respectively.
The only tricky case here is the case of VALIGN=baseline.
This modifier, which makes sense only in a
<TR> tag,
causes all of the text in a row's cells to be oriented to a single baseline.
You likely won't need to use this particular form.
Finally, there is a way to allow a cell to span multiple rows and/or columns.
This is done by adding modifiers to a
<TD> tag.
The full form is
<TD [ROWSPAN="x"] [COLSPAN="y"]>,
where x and y
indicate the number of rows and columns, respectively, that the cell must span.
An omitted modifier has a default spanning value of 1.
Be careful if you use spanning:
an incorrect value can cause unpredictable results.
With all of this additional information,
it's time for another table example.
The sequence
produces
<TABLE BORDER>
<CAPTION>Example Table with Row and Column Spanning</CAPTION>
<TR><TH>Column 1</TH><TH>Column 2</TH><TH>Column 3</TH></TR>
<TR ALIGN=LEFT VALIGN=TOP>
<TD COLSPAN="2">column 1, row 2:<BR>spanning 2 columns</TD>
<TD>column 3, row 2</TD>
</TR>
<TR ALIGN=LEFT>
<TD>column 1, row 3</TD>
<TD>column 2, row 3</TD>
<TD ROWSPAN="2">column 3, row 3:<BR>spanning 2 rows</TD>
</TR>
<TR ALIGN=LEFT>
<TD>column 1, row 4</TD>
<TD>column 2, row 4</TD>
</TR>
</TABLE>
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| column 1, row 2: spanning 2 columns |
column 3, row 2 | |
| column 1, row 3 | column 2, row 3 | column 3, row 3: spanning 2 rows |
| column 1, row 4 | column 2, row 4 | |
What I have tried to present here is a minimal set that will work with all browsers and servers. I hope you find this to be a useful reference. For more information, I recommend "Setting Up a Home Page on the World-Wide Web" from UniForum.