This is the first line of an XML document: <?xml version="1.0" ?> It is optional in XHTML.
The Document Type Definition (DOCTYPE) declaraction tells the browser which XHTML 1.0 version you are using: Strict, Transitional, and Frameset. The three DOCTYPEs only differ at two points.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
1. A DOCTYPE declaration is required and the XML declaration is optional.
2. Element and attribute names must be in lowercase.
3. Elements must either have an end tag or end in />.
4. Attribute values must be quoted.
5. XHTML does not permit attribute minimization -- e.g. for a checkbox in HTML that is initially checked, one would write <input type="checkbox" checked>. In XHTML, one must write <input type="checkbox" checked="checked">
6.. Documents must be well-formed; that is, they must conform to the syntax rules of the language: contain a root element <html>, tags must be nested, all attributes must have a value.
7. One must use the id attribute for naming <form>, <frame>, and <map>.
http://validator.w3.org - XHTML
http://jigsaw.w3.org/css-validator/ - CSS - do XHTML validation first
XHTML strict does not permit the use of a number of tags and attributes that were used in HTML. The table below attempts to provide an alternative:
<font> tag | CSS properties of font-family, font-size, color |
<center> tag | <span style="text:align:center"> ...</span> -- seems to center non-text as well |
<u> tag | CSS applied to <span> or other tag: text-decoration:underline |
bgcolor, background, text attributes of <body> tag | CSS properties applied to body tag: body {background-color:value; |
alink, vlink, and link attributes of <body> tag | CSS properties: a:alink {color: value} |
target attribute of <a> tag | target is in the frameset dtd but not in strict so its use with frames would be OK |
border, hspace, and vspace attributes of <img> | CSS border properties applied to img tag border property (one possible value is none) |
align, bgcolor, background attributes of <table> tag | CSS properties applied to <table> tag: table {background-color:value; |
bgcolor, background, width attributes of <td> tag | CSS properties of background-color, background-image, and width applied to particular <td> in question For column widths, since the width of a column is constant across the rows, one can either apply this to a single row, or create a class for each column and define the width for that class. |
Revised: April 20, 2010. Comments to William Pegram, bill@billpegram.com