星期五, 二月 02, 2007

list of the coding requirements for XHTML compliance

A short list of the coding requirements for XHTML compliance

1. Declare a DOCTYPE
<!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 HTML 4.01 Transitional//EN"
<"http://www.w3.org/TR/html4/loose.dtd">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
<"http://www.w3.org/TR/html4/frameset.dtd">

2. Declare an XML namespace
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

3. Declare your content type
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />

4. Close every tag, whether enclosing or nonenclosing

5. All tags must be nested correctly

6. Inline tags can't contain block level tags

7. Write tags entirely in lowercase

8. Attributes must have values and must be quoted

9. Use the encoded equivalents for a left angle bracket and ampersand within content