Making Accessible Websites for the United Nations

Page Design: Coding

Create Valid Documents

WAI Definition (Checkpoint 3.2)

Create documents that validate to published formal grammars.

Explanation

Create documents with valid HTML or XHTML.

Rationale

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.

Technique

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.

Examples

HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/HTML4/loose.dtd">
XHTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xHTML1/DTD/xHTML1-transitional.dtd">

Validation

Test

Using the Firefox Web Developer's Toolbar (plugin):
Validate the HTML: Go to Tools > Validate HTML.
Validate the CSS: Go to Tools > Validate CSS.

Note

The W3C validator can also be accessed directly from the W3C site.

Success Criteria

The code passes validation. No errors are found.

Notes

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.