- Use the right DOCTYPE. This is the one asu.edu Web Services recommends:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><br />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - Close all tags. Example:
<p> </p> - Close all empty elements. Example:
<br />, <hr /> and <img src="example.jpg" alt="An example" /> - Spell out these character entities:
"&lt;"represents the < sign."&gt;"represents the > sign."&amp;"represents the & sign."&quot;"represents the " mark.
- Ensure elements are correctly nested.
Wrong:
<p>Close tags in correct <em>order.</p></em>
Right:<p>Close tags in correct <em>order</em>.</p> - Write all tags in lower case.
Wrong:
<IMG SRC="http://www.sitename.com/images/box.gif" ALT="Gift Box" ALIGN="left" />
Right:<img src="http://www.sitename.com/images/box.gif" alt="Gift Box" align="left" /> - Include values on all attributes.
Wrong:
<img src="http://www.sitename.com/images/box.gif" alt="Gift Box" noshade />
Right:<img src="http://www.sitename.com/images/box.gif" alt="Gift Box" noshade="noshade" /> - Put quotation marks on attribute values.
Wrong:
<img src=http://www.sitename.com/images/box.gif alt=Gift Box align=left />
Right:<img src="http://www.sitename.com/images/box.gif" alt="Gift Box" align="left" /> - Include alt attributes on all images and title attributes on all links. Example:
<a href="http://google.com" title="Google">Google</a> - Put all style information in the CSS file.
Further Reading:
- XHTML 1.0: The Extensible HyperText Markup Language (Second Edition)
- Tutorial: Character sets & encodings in XHTML, HTML and CSS
- Modifying Dreamweaver to Produce Valid XHTML
Validation Services
- CSS - W3C CSS Validation Service
- Markup - W3C Markup Validation Service
- Accessibility - Cynthia
