This is a list of the most common requirements for XHTML as per the W3C. Also see HTML for the World Wide Web, Chapter 1, page 36.
Start the document like this:
- <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> - Define your File Type with: <html xmlns=”http://www.w3.org/1999/xhtml”>
In the head section, add the character set (optional):
- <meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
Use this formatting as needed:
- 4.1. Documents must be well-formed
- All elements must have closing tags: <p>paragraph</p>
and <img scr=”pic.jpg”
/> - All the elements must nest properly: <p><b>Nested
tags</b></p>
- All elements must have closing tags: <p>paragraph</p>
- 4.2. Element and attribute names must be in lower case.
- for all HTML element and attribute names: <a
href=”#” target=”_blank“>
- for all HTML element and attribute names: <a
- 4.3. For non-empty elements, end tags are required
- <hr width=75% noshade=”noshade” />
- 4.4. Attribute values must always be quoted:
- <p class=“menu“>
- 4.5. Attribute Minimization
- Attribute-value pairs must be written in full:
- <dl compact=”compact”>
- Attribute-value pairs must be written in full:
- 4.6. Empty Elements
- Empty elements must either have an end tag or the start tag must
end with />:
<br /><hr />
- Use lower case element and attribute names.
- In tables, add a tbody element to a table if it is referred to
in a CSS selector.