Tag |
Type | Purpose |
Notes |
|---|---|---|---|
Skeletal tags |
|||
<!DOCTYPE> |
N/A |
Defines the document type |
The only tag that breaks the XHTML tag rules: there is no closing <!DOCTYPE> and it's typed in all caps. The attributes used inside the tag indicate which version of html is being used. For more information, go here. |
<html></html> |
N/A |
Defines an html document |
|
<head></head> |
N/A |
Defines the head element |
The head must be closed before the body can begin. |
<body></body> |
N/A |
Defines the body element |
(see head, above). |
Tags used in the <head> |
|||
<title></title> |
N/A |
Defines the document title. |
|
<meta />> |
N/A |
Defines meta information. |
Meta information can include keywords, descriptions, authors, copyright info, even 'refresh' commands. |
<base /> |
N/A |
Defines a base URL for all the links in a page. |
|
<style> <!-- put styles here --> </style> |
N/A |
Defines in-page CSS. |
External CSS pages are linked-to with the <link> tag (see below) |
Basic page formatting tags |
|||
<p></p> |
Block |
Defines a paragraph |
|
<h1></h1> <h2></h2> <h3></h3> <h4></h4> <h5></h5> <h6></h6> |
Block |
Defines a heading. |
There are six kinds of headings, h1 being the largest, h6 the smallest. Headings are boldface by default. |
<br /> |
N/A |
Inserts a single line break |
Note that the old break <br> is no longer valid under XHTML |
<hr /> |
Block |
Defines a horizontal rule |
I recommend using style sheets to create rules as much as possible. Note that the old horizontal rule <hr> is no longer valid under XHTML. |
<div></div> |
Block |
Defines a section in a document. |
Text in a <div> tag behaves much like text in a <p> tag, but without top & bottom margins. |
List tags |
|||
<ul></ul> |
Block |
Defines an unordered list |
This is a list with bullets. |
<ol></ol> |
Block |
Defines an ordered list |
This is a list with numbers (or letters). |
<li></li> |
Block |
Defines a list item |
Used with both <ul> and <ol> lists. Every item on a list should be surrounded by <li> tags. |
<dl></dl> |
Block |
Defines a definition list |
Definition lists have neither bullets nor numbers. |
<dt></dt> |
Block |
Defines a definition term |
Definition terms appear much like paragraphs, but without the top & bottom margins. |
<dd></dd> |
Block |
Defines a definition description |
Definition descriptions are indented on the left and also have no extra margins top and bottom. |
Character formatting |
|||
<span></span> |
Inline
|
Defines a section in a document |
Has no visual effect in and of itself; used to attach attributes & styles to inline elements. |
<em></em> |
Inline |
Defines emphasized text |
Most browsers italicize text in <em> tags, like this. Use in place of the old <i> tag. |
<strong></strong> |
Inline |
Defines strongly emphasized text |
Most browsers display text in <strong> tags as boldface, like this. Use in place of the old <b> tag. |
<big></big> |
Inline |
Defines big text |
Most browsers display <big> text as slightly larger that the default font size, like this. |
<small></small> |
Inline |
Defines small text |
Most browsers display <small> text as slightly smaller that the default font size, like this. |
<sup></sup> |
Inline |
Defines superscripted text |
Superscript is smaller script that rises above the baseline, like this. |
<sub></sub> |
Inline |
Defines subscripted text |
Subscript is smaller script that sinks below the baseline, like this. |
Other formatting tags |
|||
<blockquote> |
Block |
Defines a long quotation |
Blockqoutes display like paragraphs with left indents. This is a blockquote. |
<q></q> |
Inline |
Defines a short quote |
Most browsers will put quotes in quotation marks automatically, |
<cite></cite> |
Inline |
Defines a citation |
Citations appear in italics in most browsers. like this. |
<address></address> |
Block |
Defines an address element |
Behaves like an italicized paragraph with no default margins. This is an address. |
<ins></ins> |
Inline |
Defines inserted text |
<ins> text is usually displayed with an underline, like this. |
<del></del> |
Inline |
Defines deleted text |
<del> text is usually displayed with a strikethrough, |
<bdo></bdo> |
Inline |
Defines the direction of text display |
By itself it has no visible effect; must be combined with an attribute. For example, <bdo dir="rtl"> displays text right-to-left: This should be read right to left. |
Output |
|||
<pre></pre> |
Block |
Defines preformatted text |
Preformatted text appears exactly as it is typed, including multiple spaces: like this. |
<code></code> |
Inline |
Defines computer code text |
Typically, a browser will display <code> with the default monospace font, |
<tt></tt> |
Inline |
Defines teletype text |
Typically, a browser will display <tt> with the default monospace font, like this. |
<kbd></kbd> |
Inline |
Defines keyboard text |
Typically, a browser will display <kbd> with the default monospace font, like this. |
<var></var> |
Inline |
Defines a variable |
Typically, a browser will display <var> text as italicized, like this. |
<dfn></dfn> |
Inline |
Defines a definition term |
Some browsers, like Firefox will display <var> text as italicized, like this. Some, like Safari, will not. |
<samp></samp> |
Inline |
Defines sample computer code |
Like <code>, a browser will typiclly display <samp> with the default monospace font, like this. |
Tags that indicate blocks, but have no default visible effect |
|||
<acronym></acronym> |
Inline |
Defines an acronym |
Used mostly by text readers for the visually impaired to identify an acronym, otherwise the text reader might try to pronounce it. |
<abbr></abbr> |
Inline |
Defines an abbreviation |
Used mostly by text readers for the visually impaired to identify an abbreviation, otherwise the text reader might try to pronounce it. |
Links |
|||
<a></a> |
Inline |
Defines an anchor |
Most commonly it's combined with the href attribute to create links to other pages. |
<link /> |
N/A |
Defines a resource reference |
Usually used to link to style sheet documents in the head. |
Images & other media |
|||
<img /> |
Inline |
Defines an image |
Used to put images on a page (must be combined with the src attribute). |
<map></map> |
Inline |
Defines an image-map. |
An image-map is an image with clickable regions. The <area> element is always nested inside the <map> element. |
<area /> |
N/A |
Defines a region in an image map. |
A region is the clickable part, a "hotspot." |
<object></object> |
Inline |
Defines an embedded object. |
All media other than pictures (audio, video, Flash, etc.) should be defined by <object> tags. Here are detailed instructions on using the <object> tag to embed audio and video. |
<param /> |
N/A |
Defines a parameter for an object. |
These go between the <object> tags. See my instructions on embedding audio and video for more information. |
<embed></embed> |
Inline |
Defines an embedded object. |
<embed> is quickly going the way of the dinosaur; it's only needed by a few older browsers; soon the <object> tag will be all you need. |
Tables |
|||
<table></table> |
Block |
Defines a table. |
Tables should contain table rows <tr> and data cells <td> or <th>. |
<tr></tr> |
N/A |
Defines a table row |
Rows are horizontal. |
<th></th> |
N/A |
Defines a table header cell. |
Needs to be inside a table row. By default, text in a <tr> is centered and bold. |
<td></td> |
N/A |
Defines a table data cell. |
Needs to be inside a table row. By default, text in a <td> is aligned-left and vertically-aligned center. |
<caption></caption> |
N/A |
Defines a table caption. |
. |
<thead></thead> |
N/A |
Defines a table header. |
. |
<tbody></tbody> |
N/A |
Defines a table body. |
. |
<tfoot></tfoot> |
N/A |
Defines a table footer. |
. |
<col></col> |
N/A |
Defines attributes for table columns |
. |
<colgroup></colgroup> |
N/A |
Defines groups of table columns |
. |
Forms |
|||
<form></form> |
Block |
Defines a form |
Typically, any fields, buttons, check boxes, etc. you wish to create should go inside a form. This is a must if you want the form to actually do anything. |
<input /> |
Inline |
Defines an input type |
An input type could be a field, button or check boxes depending on the attributes chosen:
|
<textarea></textarea> |
Inline |
Defines a text area |
A text area is basically a multi-line input field:
|
<button></button> |
Inline |
Defines a push button |
In addition to an <input /> tag you can create a button with <button> tags: |
<select></select> |
Inline |
Defines a selectable list |
A selectable list is a drop-down list: |
<option></option> |
N/A |
Defines an item in a list box |
The items in the above select box (bat, ball, & glove) are each defined by an <option>. Thet go between the <select> tags. |
<label></label> |
Inline |
Defines a label for a form control |
A label is basically a caption for a button or field:
|
<fieldset></fieldset) |
Block |
Groups several related controls. |
. |
<legend></legend> |
Block |
Assigns a caption to a fieldset |
. |
Frames |
|||
<frames> |
. |
Defines a sub window (a frame) |
. |
<frameset> |
. |
Defines a set of frames |
. |
<noframes> |
. |
Defines a noframe section |
. |
<iframe> |
Inline |
Defines an inline frame. |
An inline frame is like window within a page into which other html pages can be loaded. |