XHTML stands for eXtensible HyperText Markup Language and was designed to describe data using "tags".
Tags
XHTML documents are text files made up of HTML elements.
XHTML documents are usually saved with the .html extension (some servers prefer .htm)
XHTML elements are defined using HTML tags.
Tag Attributes
Tags can have attributes. Attributes provide additional information to an HTML element.
The following tag defines an HTML table: <table>.
With an added border attribute, you can tell the browser that the table should have no borders: <table border="0">
Attributes always come in name/value pairs like this: name="value".
Attributes are always specified in the start tag of an HTML element.
Attribute values should always be enclosed in quotes.
All XHTML documents must have the following elements:
Sample miminum XHTML document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
</body>
</html>
There are currently 3 XHTML document types:
Note: The DOCTYPE declaration is not a part of the XHTML document itself.
It is not an XHTML element, and it should not have a closing tag.
| Start tag | Purpose | N | IE | DTD |
|---|---|---|---|---|
| Basic Tags | ||||
| <!DOCTYPE> | Defines the document type | STF | ||
| <html> | Defines an html document | 3.0 | 3.0 | STF |
| <body> | Defines the body element | 3.0 | 3.0 | STF |
| <h1> to <h6> | Defines header 1 to header 6. Sample: Heading 1Heading 2Heading 3Heading 4Heading 5Heading 6
|
3.0 | 3.0 | STF |
| <p> | Defines a paragraph | 3.0 | 3.0 | STF |
| <br /> | Inserts a single line break | 3.0 | 3.0 | STF |
| <hr /> | Defines a horizontal rule
|
3.0 | 3.0 | STF |
| <!-- --> | Defines a comment. Note: Never use double dashes within comment tags. Replace with a different character like = = or + + | 3.0 | 3.0 | STF |
| Char Format | ||||
| <b> | Defines bold text. Sample: This is bold. |
3.0 | 3.0 | STF |
| <i> | Defines italic text. Sample: This is italic. |
3.0 | 3.0 | STF |
| <em> | Defines emphasized text. Sample: This is emphasized. |
3.0 | 3.0 | STF |
| <strong> | Defines strong text. Sample: This is strong. |
3.0 | 3.0 | STF |
| <big> | Defines big text. Sample: This is big. |
3.0 | 3.0 | STF |
| <small> | Defines small text. Sample: This is small. |
3.0 | 3.0 | STF |
| <sup> | Defines superscripted text. Sample: This is superscript. |
3.0 | 3.0 | STF |
| <sub> | Defines subscripted text. Sample: This is subscript. |
3.0 | 3.0 | STF |
| Output | ||||
| <pre> | Defines preformatted text. Sample: This is preformatted text . |
3.0 | 3.0 | STF |
| <code> | Defines computer code text. Sample: This is code. |
3.0 | 3.0 | STF |
| <tt> | Defines teletype text. Sample: This is teletype. |
3.0 | 3.0 | STF |
| <kbd> | Defines keyboard text. Sample: This is keyboard text. |
3.0 | 3.0 | STF |
| <var> | Defines a variable. Sample: This is a variable. |
3.0 | 3.0 | STF |
| <dfn> | Defines a definition term. Sample: This is a definition |
3.0 | STF | |
| <samp> | Defines sample computer code. Sample: This is sample code. |
3.0 | 3.0 | STF |
| Blocks | ||||
| <acronym> | Defines an acronym. Sample: WWW |
6.2 | 4.0 | STF |
| <abbr> | Defines an abbreviation. Sample: etc. |
6.2 | STF | |
| <address> | Defines an address element. Sample: Drexel University 3141 Chestnut Street Philadelphia, PA 19104 |
4.0 | 4.0 | STF |
| <blockquote> | Defines a long quotation. Sample:
|
3.0 | 3.0 | STF |
| <q> | Defines a short quotation. Sample: This is a short quotation. |
6.2 | 4.0 | STF |
| <cite> | Defines a citation. Sample: This is a citation. |
3.0 | 3.0 | STF |
| <ins> | Defines inserted text. Sample: This is a sample of inserted text. |
6.2 | 4.0 | STF |
| <del> | Defines deleted text. Note: ins and del are usually used in combination to notate changes made in a document, like this... |
6.2 | 4.0 | STF |
| Links | ||||
| <a> | Defines an anchor | 3.0 | 3.0 | STF |
| <link> | Defines a resource reference | 4.0 | 3.0 | STF |
| Input | ||||
| <form> | Defines a form | 3.0 | 3.0 | STF |
| <input> | Defines an input field | 3.0 | 3.0 | STF |
| <textarea> | Defines a text area | 3.0 | 3.0 | STF |
| <button> | Defines a push button | 6.2 | 4.0 | STF |
| <select> | Defines a selectable list | 3.0 | 3.0 | STF |
| <optgroup> | Defines an option group | 6.0 | 6.0 | STF |
| <option> | Defines an item in a list box | 3.0 | 3.0 | STF |
| <label> | Defines a label for a form control | 6.2 | 4.0 | STF |
| <fieldset> | Defines a fieldset | 6.2 | 4.0 | STF |
| <legend> | Defines a title in a fieldset | 6.2 | 4.0 | STF |
| Lists | ||||
| <ul> | Defines an unordered list | 3.0 | 3.0 | STF |
| <ol> | Defines an ordered list | 3.0 | 3.0 | STF |
| <li> | Defines a list item | 3.0 | 3.0 | STF |
| <dl> | Defines a definition list | 3.0 | 3.0 | STF |
| <dt> | Defines a definition term | 3.0 | 3.0 | STF |
| <dd> | Defines a definition description | 3.0 | 3.0 | STF |
| Images | ||||
| <img> | Defines an image | 3.0 | 3.0 | STF |
| <map> | Defines an image map | 3.0 | 3.0 | STF |
| <area> | Defines an area inside an image map | 3.0 | 3.0 | STF |
| Tables | ||||
| <table> | Defines a table | 3.0 | 3.0 | STF |
| <caption> | Defines a table caption | 3.0 | 3.0 | STF |
| <th> | Defines a table header | 3.0 | 3.0 | STF |
| <tr> | Defines a table row | 3.0 | 3.0 | STF |
| <td> | Defines a table cell | 3.0 | 3.0 | STF |
| <thead> | Defines a table header | 4.0 | STF | |
| <tbody> | Defines a table body | 4.0 | STF | |
| <tfoot> | Defines a table footer | 4.0 | STF | |
| <col> | Defines attributes for table columns | 3.0 | STF | |
| <colgroup> | Defines groups of table columns | 3.0 | STF | |
| Styles | ||||
| <style> | Defines a style definition | 4.0 | 3.0 | STF |
| <div> | Defines a section in a document | 3.0 | 3.0 | STF |
| <span> | Defines a section in a document | 4.0 | 3.0 | STF |
| Meta Info | ||||
| <head> | Defines information about the document | 3.0 | 3.0 | STF |
| <title> | Defines the document title | 3.0 | 3.0 | STF |
| <meta> | Defines meta information | 3.0 | 3.0 | STF |
| <base> | Defines a base URL for all the links in a page | 3.0 | 3.0 | STF |
| Programming | ||||
| <script> | Defines a script | 3.0 | 3.0 | STF |
| <noscript> | Defines a noscript section | 3.0 | 3.0 | STF |
| <object> | Defines an embedded object | 3.0 | STF | |
| <param> | Defines a parameter for an object | 3.0 | 3.0 | STF |
<meta name="" content="" />
Sample Meta Tags:
<meta name="keywords" content="comma, separated, list, of, relevant, word groups" />
<meta name="description" content="Brief summary about the page." />
<meta name="copyright" content="Copyright © 2007 Company Name. All Rights Reserved." />
<meta name="author" content="Your Name Here" />
<meta name="language" content="English" />
<meta name="revisit-after" content="15" />
<meta name="robots" content="ALL, INDEX" />
<meta name="Revisit-After" content="30 Days" />
<meta name="revised" content="6/10/99" />
Updated on: August 20, 2007