HTML Cheat Sheet

HTML documents have a tree structure, with each element parenthesized by a start tag <element> and an end tag </element>.

Heading Elements

The heading elements generally appear in the following order.
<html>
An HTML document.
<head>
The document heading.
<title>text</title>
The title should include the context of the document, such as the institution or author.
<link ...>
The relationship of this document to other documents. Examples include predecessor and subdocument. This is not yet defined.
</head>

Leading Body Elements

The leading body elements generally appear in this order.
<body>
The document body.
<h1>text</h1>
The level one heading corresponds to the title, but generally does not include the context. There should be only one level one heading.

Sectioning

<hn>text</hn>
A level n heading, n>1.
<p>
The paragraph separator. (It will become a start of paragraph in later versions.)
<pre>text</pre>
Preformatted text in fixed-width font.
<blockquote>text</blockquote>
Block quoted text.
<address>text</address>
An address.
<br>
line break
<hr>
horizontal rule
<!-- text -->
Unformatted, undisplayed comments. Note, however, that readers may view the source and see the comments.

Lists

<ul> <li>text ... </ul>
Unordered list.
<ol> <li>text ... </ol>
Ordered list.
<dl> <dt>term text<dd>definition text ... </dl>
Definition list.

Semantic Fonts

<em>text</em>
Emphasized text.
<strong>text</strong>
Strongly emphasized text.
<dfn>text</dfn>
A word or text being defined.
<cite>text</cite>
Title text of books, films, etc.
<code>text</code>
Snippets of computer code text.
<kbd>text</kbd>
User keyboard entry text.
<samp>text</samp>
Computer status message text.
<var>text</var>
Metasyntactic variable text.

Presentation Fonts

<b>text</b>
Bold text.
<i>text</i>
Italic text.
<u>text</u>
Underlined text on some browsers.
<tt>text</tt>
Teletype text.
<blink>text</blink>
Blinking text on some browsers.

Character Entities

&lt; is <
&gt; is >
&amp; is &
&quot; is "
&nbsp; is a non-breaking space
&ouml; is ö (lowercase o with an umlaut)
&ntilde; is ñ (lowercase n with a tilde)
&Egrave; is È (uppercase E with a grave accent)
see also ISO Latin 1 Entities in HTML

Anchors and References

<a name="label">text</a>
An anchor definition for text.
<a href="URL">text</a>
An anchor reference where URL is the uniform resource locator and text is the reference text.
scheme://host:port/path/filename.extension#label
A Uniform Resource Locator where
scheme:
is one of file:, ftp:, http:, gopher:, WAIS:, news:, or telnet:. The default is http:.
//host
defaults to the host of the current document.
:port
defaults to ?what?.
/path/
defaults to the current path.
filename
defaults to the current file.
.extension
is one of
text
.txt, .html
static picture
.ps (Postscript) .gif, .tiff, .xbm (X bitmap), .jpg, .jpeg
motion picture
.mpg, .mpeg, .mov (Quicktime)
sound
.aiff, .au
#label
is a label reference within an HTML file. The default is the top of the file.
<img align=alignment src="URL.ext" alt="text">
An in-line image reference.
alignment
Chose top, middle, or omit for bottom.
.ext
Choose .gif or .xbm (X bitmap). For non-imaging browsers, text will be substituted for the image if present.

Author Identification

<hr> <address> <a href="http://www.cs.orst.edu/~crowl/">Lawrence A. Crowl</a>, <a href="/cgi-bin/mailform?crowl@cs.orst.edu">crowl@cs.orst.edu</a>, 5 April 1995 </address>

Trailing Elements

</body>
End of body.
</html>
End of HTML document.

Lawrence A. Crowl, crowl@cs.orst.edu, 7 September 1995