Coding Standards
A DOCTYPE specification MUST be used at the beginning of the web page
o A DOCTYPE (short for ‘document type declaration’) informs the validator which version of (X)HTML you’re using, and must appear at the very top of every web page.
o Doctypes are a key component of compliant web pages: your markup and CSS won’t validate without them.
o Netscape 6 and above, Internet Explorer 6 on Windows, and Internet Explorer 5 for Macintosh all support DOCTYPE switching
o For XHTML strict:
(Use this doctype when you’re not using any deprecated or frameset tags with XHTML.)
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
o For XHTML transitional:
(Use this doctype if your document is in XHTML and contains
deprecated tags.)
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
o For XHTML frameset:
(Use this doctype if your document is in XHTML and contains
frameset tags and/or deprecated tags.)
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”>
Tags and attributes MUST be in lower case
o This is because XHTML documents are XML applications. XML is case-sensitive. Tags like <p> and <P> are interpreted as different tags.
o <body>
<p><a href=”My Link”>This is correct</a></p>
</body>
Elements MUST be nested correctly.
o This is wrong:
- <p><b>This is not correct</p></b>
o This is correct:
<p><b>This is correct</b></p>
Attribute values SHOULD always be quoted.
o This is wr
- <table width=640><tr><td>This is not correct</td></tr></table>
- o This is correct:
- <table width=”640″><tr><td>This is correct</td></tr></table>
- All pages MUST have a page title. This title will match the heading title at the top of the content section.
Example:
<title>Nevada Department of Transportation Homepage</title>