1. Accessibility & Legislation
  2. Common Issues
  3. Testing & Tools
  4. Analysing Your Site

2.13 Common issues: Formal grammars


When developing websites it is highly recommended that each page has it's HTML code checked for validity. This can save hours in repair time when discovering faults and glitches. It also presents fewer problems on cross-browser cross-platform compliance.

The W3C provide a free online validator for both HTML and CSS. These validators will work with an online site or a locally held copy.

For simplicity we have created a page checker that runs all three of the above in a single frameset.

Prior to validation it is necessary for each page to have both a valid doctype and character encoding set.


Validating to a published formal grammar and declaring that validation at the beginning of a document lets the user know that the structure of the document is sound. It also lets the user agent know where to look for semantics if it needs to. The W3C Validation Service validates documents against a whole list of published grammars.

For example this page is XHTML strict and the doctype declared is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

Character encoding

The recommended character encoding is UTF-8.

This is declared:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

Which is added in the head section of the code.

Who and what does this affect?

WAI guidelines on formal grammers

Further information.

Common issues