Page Design: Coding
Create Valid Documents
WAI Definition (Checkpoint 3.2)
Create documents that validate to published formal grammars.
Create documents with valid HTML or XHTML.
HTML and XHTML syntax is standardized to ensure a consistent interpretation of pages by different browsers and devices. A valid page will therefore be more widely supported, whether it is accessed by an old browser, a screen reader or a handheld device.
Add a "doctype" declaration (see example below) at the top of the HTML page if it is not present in order to specify which version of HTML or XHTML is used.
If unfamiliar with HTML syntax, please make sure a recent version of a robust HTML editor is used. Do not use MS Word to create HTML files.
Tools such as "HTML Tidy" are helpful in cleaning up the code of existing pages.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xHTML1/DTD/xHTML1-transitional.dtd">
Using the Firefox Web Developer's Toolbar (plugin):
Validate the HTML: Go to Tools > Validate HTML.
Validate the CSS: Go to Tools > Validate CSS.
The W3C validator can also be accessed directly from the W3C site.
The code passes validation. No errors are found.
The W3C validator only checks if the page is coded according to defined standards. It does not validate other aspects of accessibility.
If your server cannot be accessed by the W3C validator in a test or intranet environment, in Tools, select Display Page Validation and check the icons in the toolbar, or in Tools, select Validate Local CSS and Validate Local HTML.