XHTML Quick Reference
The tags described below are all defined within the strict XHTML 1.0 document type definition, and are supported in the current versions of all major browsers. Note that there are many more XHTML tags available to you, but the subset described on this page includes those most frequently used, and should suffice for most purposes (for a more comprehensive XHTML reference, visit http://xhtml.com/en/xhtml/reference/).
| XHTML 1.0 Tags | |
| Tag | Description and usage |
| <!-- . . . --> | Comment - used to enclose a comment within the source code (note that this is not strictly speaking an XHTML tag, and does not therefore require a closing solidus). Example: <!-- this is a comment! --> |
| <!DOCTYPE . . . > | Document type - the document type declaration is the first thing to appear in an XHTML document (note that this is not strictly speaking an XHTML tag, and does not therefore require a closing solidus). Example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
| <a> . . . </a> | Anchor - used to create a link to another document, a bookmark within a document, or a link to a bookmark within a document. Example: <a href="http://www.technologyuk.net">Visit TechnologyUK</a> |
| <area> . . . </area> | Area - defines an area within an image map. Example: <img src ="family.gif" width="160" height="120" alt="Family" |
| <b> . . . </b> | Bold - the enclosed text appears in bold type. Example: Here is some <b>bold</b> text. |
| <body> . . . </body> | Body - encloses the contents of a HTML document (i.e. those elements that will be visible within the browser window). Example: <html> |
| <br /> | Break - inserts a single line break. This is an empty tag, and in XHTML must include a solidus immediately before the closing angle bracket. Example: Here is some text that<br />contains a line break. |
| <button> . . . </button> | Button - defines a push button that can display either text or an image. Example: <button type="submit">Click me!</button> |
| <div> . . . </div> | Division - defines a discrete section within an XHTML document. This tag can be used together with cascading style sheets to create a document layout. Example: <div> |
| <em> . . . </em> | Emphasis - the enclosed text is emphasised.
Example: This text needs to be <em>emphasised</em>. |
| <form> . . . </form> | Form - creates a form that can contain text boxes and other controls that allow a user to enter text or make choices. Example:
<form action="my_script.php" method="post"> |
| <h1> . . . </h1> <h2> . . . </h2> <h3> . . . </h3> <h4> . . . </h4> <h5> . . . </h5> <h6> . . . </h6> | Document heading - this tag creates a document heading. There are six heading levels, with level one being the largest and level six being the smallest. Example: <h1>This is a level one heading</h1> |
| <head> . . . </head> | Head - encloses the document header information for a HTML document. Usually contains the <title> . . . </title> tag, meta information, and links to external files such as cascading style sheet files and script files. Example: <head> |
| <hr /> | Hard return - inserts a single line break and draws a line across the screen. This is an empty tag, and in XHTML must include a solidus immediately before the closing angle bracket. Example:
This text is above the line . . . |
| <html> . . . </html> | HTML - encloses the document header and body elements, and tells the browser that this is an HTML document. Example:
<html> |
| <i> . . . </i> | Italic - the enclosed text appears italicised.
Example: Here is some <b>italic</b> text. |
| <img /> | Image - used to display a graphic image within a web page. This is an empty tag, and in XHTML must include a solidus immediately before the closing angle bracket. Example: <img src="circle.gif" alt="A picture of a circle." /> |
| <input /> | Input - defines an input control on a form. An input field can be a text box, checkbox, radio button or push button, depending on its type attribute. This is an empty tag, and in XHTML must include a solidus immediately before the closing angle bracket. (see <form>) |
| <label> . . . </label> | Label - defines a label for an input element on a form. Example:
<form> |
| <li> . . . </li> | List item - defines one item in a list of items. Example:
<ul> |
| <link /> | Link - defines a link to an external file, such as a style sheet. This is an empty tag, and in XHTML must include a solidus immediately before the closing angle bracket. Example:
<head> |
| <map> . . . </map> | Image map - defines a client side image map. An image map is an embedded image that has clickable areas that provide links to bookmarks or other pages. (see <area>) |
| <meta /> | Metatag - encloses information about the contents of an HTML document. This is an empty tag, and in XHTML must include a solidus immediately before the closing angle bracket. Example:
<head> |
| <noscript> . . . </noscript> | No script - contains alternative content for client browsers that do not support client-side scripts. Example:
<script type="text/javascript"> |
| <object> . . . </object> | Object - used to define an embedded object of some type (e.g. Flash movie, Java applet etc.). Example:
<object classid="clsid:1B487523-BEC2-11CF-BF9E-0020AF998FF5" |
| <ol> . . . </ol> | Ordered list - encloses a numbered list of items, each defined using the <li> . . . </li> tagset. Example:
<ol> |
| <option> . . . </option> | Option - defines the options available from a drop down selection box in a form. Example:
<form> |
| <p> . . . </p> | Paragraph - the enclosed text is treated as a separate paragraph. A blank line is inserted before and after the text. Example: <p> This text is treated as a paragraph.</p> |
| <param /> | Parameter - used to define a parameter for an object element. This is an empty tag, and in XHTML must include a solidus immediately before the closing angle bracket. (see <object>) |
| <script> . . . </script> | Script - encloses in-line code written in a client-side scripting language such as JavaScript. (see <noscript>) |
| <select> . . . </select> | Select - defines a drop-down selection box in a form. (see <option>) |
| <span> . . . </span> | Span - defines a portion of a document that can be manipulated using scripting or a style sheet. It has no visible effect on the enclosed text otherwise. Example:
<p> |
| <strong> . . . </strong> | Strong - renders the enclosed text in a heavier (emboldened) font. Example: The last word in this sentence is <strong>strong</strong>! |
| <style> . . . </style> | Style - used to define style information within an HTML document.
Example:
<head> |
| <sub> . . . </sub> | Subscript - enclosed text is displayed as subscripted text. Example: V<sub>Total</sub> is the sum of V<sub>1</sub> |
| <sup> . . . </sup> | Superscript - enclosed text is displayed as superscripted text. Example: Signals propagate at (circa) 2x10<sup>8</sup> |
| <table> . . . </table> | Table - defines a table.
Example:
<table> |
| <th> . . . </th> | Table header - defines a column heading in a table (see <table>) |
| <td> . . . </td> | Table data - defines a cell in a table (see <table>) |
| <textarea> . . . </textarea> | Text area - defines a multi-line text input control on a form. The rows and cols attributes can be used to control the visible area of the input box. Example:
<form action="my_script.php" method="post"> |
| <title> . . . </title> | Title - defines the title of an HTML document. Example: <title>My Document</title> |
| <tr> . . . </tr> | Table row - defines a row in a table (see <table>) |
| <ul> . . . </ul> | Unordered list - encloses a bulleted list of items, each defined using the <li> . . . </li> tagset. Example:
<ul> |