HTML Reference with Examples


This is a list of HTML (HyperText Markup Language) codes with examples. It was originally written by Earle Goodman (goodman@ucdavis.edu) who gathered information from a variety of sources, but a lot came directly from the HTML Quick Reference. I updated it and added examples and cross references.

There is an HTML 4.01 Specification at the W3C Home Page.

I have a Table Sampler. This page includes codes for Specials Symbols, Math, Greek, Business, Foreign Letters.


<!-- text -->
Comment text out of the HTML code. Note that there must be a space after <!-- and before -->.
<a ATTRIBUTE> picture/text </a>;
Adds an anchor to picture/text. Possible ATTRIBUTEs are:
href="#anchor_name"
Link this to anchor_name within this document.
href="URL"
Link this to URL.
href="URL#anchor_name"
Link this to anchor_name within URL.
href="URL?search_string"
Link this to search for search_string within URL.
METHODS
NAME="anchor_name"
Make an anchor at this spot that is called anchor_name.
REL
REV
TITLE
URN
<address>address</address>
Present address information. Causes a line break.
George Washington, Virginia
<base>
Specify the name of file in which the current document is stored. This is usually placed in the head of the document.
<blockquote> . . . </blockquote>
Defines a section as being quoted from another source. For instance,
No power or authority can or ought to be maintained by virtue of [an office]
In my browser, it causes paragraph breaks.
<body> . . . </body>
Defines the body of an HTML document.
<br>
Force a line break, (use two for a blank line).
<cite> . . . </cite>
Cite some material.
<code> . . . </code>
Display this as HTML code.
<dd> definition </dd>
Display a definition in a definition list or glossary. See <dl> and <dt>. (Commonly used to make lists without bullets or numbers).
<dfn>definition</dfn>
Display a definition.
<del>text</del>
Indicate that text is deleted, usually by a "strike through" font. Also see <ins>.
<div> . . . </div>
Define this area as a division or block. Also see <p>. Example: there is a
centered division
embedded in this sentence.
<dl> . . . </dl>
Make a definition list or glossary. See <dt>, <dd>, <ol>, and <ul>. (Commonly used to make lists without bullets or numbers). Example:

This is item begins with <dt>. Later lines of <dt>'s line up with this lefthand side.
This item begins with <dd>. If the entry is too long, it is indented on additional lines.

This is the second <dd> item and is preceeded by a <p>. <dd>'s should be enclosed by <p> </p>'s to stand out.

This is the third <dd> item. It is not preceeded by anything.
This is the second <dt> item.
<dt>'s should always be followed by at least one <dd>.
<dt> term
Display a term in a definition list or glossary. See <dl> and <dd>.
<EM>text</EM>
Emphasizes text. Also see <STRONG>.
<FONT>
Change font from here on. Some browsers support a C O L O R attribute. For more possibilities, see the Color Samples Page.
<FORM ATTRIBUTE> . . . </FORM>
Define an online form. The information is sent to a query server to search for or collect information for a database. Forms may have <INPUT> (for buttons or single lines of text), <SELECT> (for menus), or <TEXTAREA> (for text rectangles) tags. Possible ATTRIBUTEs are:
ACTION="URL"
The URL of the query server.
METHOD=method
The method should be post.
For an example of handling POST data go to this HTML tutorial and click Forms, then <FORM ...>, then METHOD, then POST which takes you to METHOD = POST
<H1>text</H1>
Make text header style 1, the most prominent. May have ALIGN attribute. Example (align=center):

Header 1

<H2>text</H2>
Make text header style 2. Example (align=right):

Header 2

<H3>text</H3>
Make text header style 3. Example:

Header 3

<H4>text</H4>
Make text header style 4. Example:

Header 4

<H5>text</H5>
Make text header style 5. Example:
Header 5
<H6>text</H6>
Make text header style 6, the least prominent. Example:
Header 6
<HEAD> . . . </HEAD>
Defines the head of an HTML document.
<HR>
Place a horizontal rule, or separator between sections of text. Example:
Many browsers allow SIZE, ALIGN, and WIDTH attributes. Example:
<HTML> . . . </HTML>
Defines an HTML document.
<IMG ATTRIBUTE>
Load an inline image (on browsers that support it). Possible ATTRIBUTEs are:
ALIGN=alignment
How to align the picture with the text, possible alignments are top, middle, or bottom.
ALT="text"
Alternative text that is displayed if browser does not support images, or image cannot be loaded.
BORDER=pixels
Thickness of border in pixels. 0 for no border.
HEIGHT=pixels
height of the image in pixels.
WIDTH=pixels
width of the image in pixels. Height and width allows the browser to display the page before the image is downloaded.
width of the image in pixels.
SRC="URL"
The URL of the image.
<KBD>key</KBD>
Display key as a key from the keyboard.
<ins>text</INS>
Indicate that text is inserted, usually by an underlined font. Also see <del>.
<LI> item
Display item in a list. See <ol> and <ul>.
<LINK ATTRIBUTE>
Specify relationships to other documents. This is usually placed in the head of the document. Possible ATTRIBUTEs are:
REV=relationship
The relationship of this file to the other one. The relevant relationship is made.
href="URL"
The URL of the file pointed to by the link.
<OL ATTRIBUTE> . . . </ol>
Display an ordered list or glossary. (Headed by numbers.) See <LI>, <dl>, and <ul>. Example:
  1. This item begins with <LI>. It is indented and numbered. Wrapped lines are indented to line up with the beginning.
  2. This is the second <LI> item.
An ATTRIBUTE is:
start="number"
The first number in the list. Example:
  1. This the "fourth" item. (Where did item 3 go? I don't know.)
  2. This attribute is useful when you want to continue numbering from a previous list.
<p> . . . </p>
Define this area as a paragraph, and format accordingly. Also see <div>.
<PRE> . . . </PRE>
Define this area as preformatted text, and display as is. May include some tags.
     This may include links, for example, to STRONG
	  but	it	doesn't left justify
or fill   and  may			handle tags
<STRONG>text</STRONG>
Give strong emphasis to text. Also see <EM>.
<SUB>text</SUB>
Display text in subscript position. Example:
xj < xj+1
<SUP>text</SUP>
Display text in superscript position. Example:
A quadratic equation is ax2 + bx + c
There are special sequences for superscript 2 and 3, which are easier to render and look better. Example:
The answer is zy³ + ax² + bx + c
<TABLE>, <TD>, <TH>, and <TR>
Find out about tables by looking at these examples of tables.
<TITLE>title</TITLE>
Define the title of the document. Note this is not a header. This is usually placed in the head of the document.
<TT>text</TT>
Display text in a typewriter font.
<ul> . . . </ul>
Display an unordered list or glossary. Usually headed by bullets. See <LI>, <dl>, and <ol>. Example:
  • This item begins with <LI>. It is indented and begins with a "bullet." As you can see, wrapped lines are indented.
  • This is the second <LI> item.

Codes for Special Characters

&amp;
ampersand (&)
&gt;
greater than (>)
&lt;
less than (<)
&quot;
double quote (")
&nbsp;
non-breaking space ( ). A bunch of these (->        <-) aren't displayed as one space like spaces (-> <-) are.
&#ascii;
ASCII character for decimal ascii. There is also a list of all characters from 161 to 255.
&iquest;
inverted question mark (¿)
&iexcl;
inverted exclamation mark (¡)
&sect;
section (§)
&para;
paragraph (¶)
&bull;
bullet (•)

The following don't show up in some fonts.

&dagger;
dagger (†)
&Dagger;
double dagger (‡)
&mdash;
em-dash (—)
&lsaquo;
left ? (‹) instead of <
&rsaquo;
right ? (›) instead of >
&laquo;
left ? («)
&raquo;
right ? (»)
&apos;
apostrophe (') instead of '
&lsquo;
left single quote (‘) instead of '
&rsquo;
right single quote (’)
&ldquo;
left double quote (“) instead of "
&rdquo;
right double quote (”)

Codes for Math

&sup2;
superscript 2 (x²)
&sup3;
superscript 3 (x³)
&int;
integral (∫)
&sum;
summation (∑)
&prod;
product (∏)
&radic;
square root (√)
&minus;
minus (−) instead of -
&plusmn;
plus/minus (±)
&infin;
infinity (∞)
&asymp;
approximately equal (≈)
&prop;
proportional (∝)
&equiv;
equivalent (≡)
&ne;
not equal (≠)
&le;
less than or equal (≤)
&ge;
greater than or eqal (≥)
&times;
times (×) instead of x.
&middot;
dot (·)
&divide;
divide (÷)
&part;
partial derivative (∂)
&prime;
prime (′) instead of '
&Prime;
double prime (″) instead of "
&nabla;
nabla (∇)
&permil;
per mil (‰)
&deg;
degree (°)
&there4;
therefore (∴)
&oslash;
empty set (ø)
&isin;
member (∈)
&notin;
not in (∉)
&cap;
cap (∩)
&cup;
cup (∪)
&sub;
proper subset (⊂)
&sup;
proper superset (⊃)
&sube;
subset (⊆)
&supe;
superset (⊇)
&not;
not (¬)
&and;
and (∧)
&or;
or (∨) instead of V
&exist;
there exists (∃)
&forall;
for all (∀)
&rarr;
right arrow (→)
&larr;
left arrow (←)
&harr;
arrow (↔)
&rArr;
right double arrow (⇒)
&lArr;
left double arrow (⇐)
&hArr;
double arrow (⇔)

Codes for Greek (and Hebrew Aleph)

&alefsym;
Hebrew aleph (ℵ)
 
&alpha;
alpha (α)
&beta;
beta (β)
&gamma;
gamma (γ)
&Gamma;
Gamma (Γ)
&delta;
delta (δ)
&Delta;
Delta (Δ)
&epsilon;
epsilon (ε)
&zeta;
zeta; (ζ )
&eta;
eta (η)
&theta;
theta (θ)
&Theta;
Theta (Θ)
&iota;
iota (ι)
&kappa;
kappa (κ)
&lambda;
lambda (λ)
&Lambda;
Lambda (Λ)
&mu; or &micro;
mu (μ or µ)
&nu;
nu (ν)
&xi;
xi (ξ)
&Xi;
Xi (Ξ)
&omicron;
omicron (ο)
&pi;
pi (π)
&Pi;
Pi (Π)
&rho;
rho (ρ)
&sigma;
sigma (σ)
&Sigma;
Sigma (Σ)
&sigmaf;
sigmaf (ς)
&tau;
tau (τ)
&upsilon;
upsilon (υ)
&phi;
phi (φ)
&Phi;
Phi (Φ)
&chi;
chi (χ)
&psi;
psi (ψ)
&Psi;
Psi (Ψ)
&omega;
omega (ω)
&Omega;
Omega (Ω)

Codes for Business

&cent;
Cent (¢)
&euro;
Euro (€)
&pound;
Pound sterling (£)
&yen;
Yen (¥)
&curren;
currency (¤)
&copy;
copyright mark (©)
&reg;
registered trademark (®)
&trade;
trademark (™)

Codes for Letters from other Languages

&Aacute;
capital A, acute accent (Á)
&aacute;
small a, acute accent (á)
&Acirc;
capital A, circumflex accent (Â)
&acirc;
small a, circumflex accent (â)
&AElig;
capital AE diphthong (ligature) (Æ)
&aelig;
small ae diphthong (ligature) (æ)
&Agrave;
capital A, grave accent (À)
&agrave;
small a, grave accent (à)
&Aring;
capital A, ring (Å)
&aring;
small a, ring (å)
&Atilde;
capital A, tilde (Ã)
&atilde;
small a, tilde (ã)
&Auml;
capital A, dieresis or umlaut mark (Ä)
&auml;
small a, dieresis or umlaut mark (ä)
&Ccedil;
capital C, cedilla (Ç)
&ccedil;
capital c, cedilla (ç)
&Eacute;
capital E, acute accent (É)
&eacute;
small e, acute accent (é)
&Ecirc;
capital E, circumflex accent (Ê)
&ecirc;
small e, circumflex accent (ê)
&Egrave;
capital E, grave accent (È)
&egrave;
small e, grave accent (è)
&Euml;
capital E, dieresis or umlaut mark (Ë)
&euml;
small e, dieresis or umlaut mark (ë)
&ETH;
capital Eth, Icelandic (Ð)
&eth;
small eth, Icelandic (ð)
&Iacute;
capital I, acute accent (Í)
&iacute;
small i, acute accent (í)
&Icirc;
capital I, circumflex accent (Î)
&icirc;
small i, circumflex accent (î)
&Igrave;
capital I, grave accent (Ì)
&igrave;
small i, grave accent (ì)
&Iuml;
capital I, dieresis or umlaut mark (Ï)
&iuml;
small i, dieresis or umlaut mark (ï)
&Ntilde;
capital N, tilde (Ñ)
&ntilde;
small n, tilde (ñ)
&Oacute;
capital O, acute accent (Ó)
&oacute;
small o, acute accent (ó)
&Ocirc;
capital O, circumflex accent (Ô)
&ocirc;
small o, circumflex accent (ô)
&Ograve;
capital O, grave accent (Ò)
&ograve;
small o, grave accent (ò)
&Oslash;
capital O, slash (Ø)
&oslash;
small o, slash (ø)
&Otilde;
capital O, tilde (Õ)
&otilde;
small o, tilde (õ)
&Ouml;
capital O, dieresis or umlaut mark (Ö)
&ouml;
small o, dieresis or umlaut mark (ö)
&szlig;
small sharp s, German (sz ligature) (ß)
&THORN;
capital THORN, Icelandic (Þ)
&thorn;
small thorn, Icelandic (þ)
&Uacute;
capital U, acute accent (Ú)
&uacute;
small u, acute accent (ú)
&Ucirc;
capital U, circumflex accent (Û)
&ucirc;
small u, circumflex accent (û)
&Ugrave;
capital U, grave accent (Ù)
&ugrave;
small u, grave accent (ù)
&Uuml;
capital U, dieresis or umlaut mark (Ü)
&uuml;
small u, dieresis or umlaut mark (ü)
&Yacute;
capital Y, acute accent (Ý)
&yacute;
small y, acute accent (ý)
&yuml;
small y, dieresis or umlaut mark (ÿ)

Karen M. Strom made a set of gifs of Greek Letters and Math Symbols in case your browser doesn't support the fanicer set.

Find out about forms at Decoding forms with CGI.


Updated Mon Mar 24 15:43:39 2008
by Paul E. Black  (paul.black@nist.gov)