HTML Quick Reference Guide
This page uses the current recommendation (XHTML 1.1 - defined in 2001).
| Click on a category to jump directly there | ||
|---|---|---|
| Document Structure Tags | |||
|---|---|---|---|
| Function | Tag | Attributes | Ending Tag |
| Specification | <!DOCTYPE> | * refer to doctype examples | none |
| File Type | <html> | lang="en"|"fr"|"de"|etc. | </html> |
| Header | <head> | lang="en"|"fr"|"de"|etc. | </head> |
| File Title | <title> | none | </title> |
| File Comments | <!-- | none | --> |
| File Body | <body> | onLoad="function_name" | </body> |
| Heading | <h1>..<h6> | none | </h1>..</h6> |
| Division | <div> | none | </div> |
| Paragraph | <p> | none | </p> |
DocType Examples
For a html 4 document:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
For a xml transitional document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
For a xml strict document:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
For an xml 1.1 document
<?xml version="1.1" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
| Basic Text Tags | |||
|---|---|---|---|
| Function | Tag | Ending Tag | |
| Line Break | <br/> | none | |
| Horizontal Rule | <hr/> | none | |
| Span | <span> | </span> | |
| Strong | <strong> | </strong> | |
| Emphasis | <em> | </em> | |
| Preformatted | <pre> | </pre> | |
| Subscript | <sub> | </sub> | |
| Superscript | <sup> | </sup> | |
| Block Quote | <blockquote> | </blockquote> | |
| Citation | <cite> | </cite> | |
| URI Specifications | |
|---|---|
| Function | Specification |
| Internal | #IDlabel |
| Remote site | http://www.tsn.ca/ |
| Same folder | otherone.htm |
| Down a level | subfolder/otherone.htm |
| Up a level | ../otherone.htm |
| External/Internal File Linking Tags | |||
|---|---|---|---|
| Function | Tag | Attributes | Ending Tag |
| Hyperlink | <a> | href="URI_spec" target="framename_or_keyword" |
</a> |
| Link to Image | <img/> | src="URI_spec" [Required] alt="text" [Required] ismap="ismap" usemap="mapname" |
none |
| Internal Style | <style> | type="text/css" [Required] | </style> |
| Link to CSS File | <link/> | type="text/css" [Required] href="URI_spec" [Required] rel="stylesheet" |
none |
| Internal Script | <script> | type="text/javascript" [Required] | </script> |
| Link to Script File | <script> | type="text/javascript" [Required] src="URI_spec" [Required] |
</script> |
| Link to Object File | <object> | type="mime_spec" [Required] data="URI_spec" [Required] <param_element> width="xx" height="yy" |
</object> |
| Link to Favicon File | <link/> | rel="icon" href="URI_spec" |
none |
| Link to Favicon File | <link/> | rel="shortcut icon" href="URI_spec" |
none |
| List Tags | |||
|---|---|---|---|
| Function | Tag | Attributes | Ending Tag |
| Unordered List | <ul> | type="disc"|"circle"|"square" | </ul> |
| Ordered List | <ol> | type="1"|"A"|"I"|"a"|"i" start="XX" |
</ol> |
| List Item | <li> | type={any of ul and ol options} | </li> |
| Definition List | <dl> | none | </dl> |
| Definition List Item | <dt> | none | </dt> |
| Definition List Definition | <dd> | none | </dd> |
| Table Tags | |||
|---|---|---|---|
| Function | Tag | Attributes | Ending Tag |
| Table | <table> | summary="message" [Required] | </table> |
| Table Row | <tr> | none | </tr> |
| Table Data | <td> | scope="row|col|rowgroup|colgroup" | </td> |
| Table Header | <th> | headers="id_name1 idname2 etc" | </td> |
| Caption | <caption> | align="left"|"center"|"right" *** valign="top"|"middle"|"bottom" *** |
</caption> |
| Meta Tags | |||
|---|---|---|---|
| Function | Tag | Attributes | Ending Tag |
| Content metatags | <meta/> | name="keywords"|"description" content="your information" |
none |
| Encoding metatags | <meta/> | http-equiv="Content-Type" content="text/html;charset=iso-8859-1" |
none |
| Server metatags | <meta/> | http-equiv="refresh" content="seconds; url=filename" |
none |
| Form Tags | |||
|---|---|---|---|
| Function | Tag | Attributes | Ending Tag |
| Form | <form> | method="get"|"put" action="URI_spec"|"prog_name" enctype="mime_type" |
</form> |
| Fieldset | <fieldset> | </fieldset> | |
| Legend | <legend> | </legend> | |
| Label | <label> | for="id_name" | </label> |
| Input Control | <input/> | id="variablename" type="text"|"password"| "hidden"|"checkbox"|"radio"| "reset"|"submit"|"file"|"image" maxlength="#" |
none |
| Scrolled Text Control | <textarea> | id="variablename" rows="XX" cols="XX" |
</textarea> |
| Selection List | <select> | id="variablename" size="XX" multiple="multiple" |
</select> |
| Selection Option | <option> | selected="selected" | </option> |
| Frame Tags | |||
|---|---|---|---|
| Function | Tag | Attributes | Ending Tag |
| Base | <base/> | target="framename"| "_self"|"_parent"| "_blank"|"_top" (Note the underscores) |
none |
| InFlow Frame | <iframe> | src="filename" frameborder="0"|"1" scrolling="auto"|"yes"|"no" marginwidth="XX" marginheight="XX" |
</iframe> |
| ClientSide Imagemap Tags | |||
|---|---|---|---|
| Function | Tag | Attributes | Ending Tag |
| Define Map | <map> | name="mapname" | </map> |
| Area Definition | <area/> | shape="rect|circle|poly|point" coords="X,Y,X,Y" href="URI_spec" alt="description" [Required] |
none |
| Commonly Used Special Characters | ||
|---|---|---|
| Name | Symbol | HTML Equivalent |
| ampersand | & | & |
| greater than | > | > |
| less than | < | < |
| hash (pound) | # | # |
| non-breaking space | | |
| cent sign | ¢ | ¢ |
| copyright symbol | © | © or © |
| degree sign | ° | ° |
| registered trademark | ® | ® |
| trademark | ™ | ™ |