Web sites are written in specific languages, and just like human languages, they have their own grammar, vocabulary and syntax. Every web page written in these computer languages are supposed to follow these rules. However just like texts in a human language can include spelling or grammatical errors, web pages using computer languages can also include these types of mistakes. The process of verifying whether a web page actually follows the rules for the language(s) it uses is called validation, and the tool used for that is a validator. A web page that passes this process with success is called valid or that it complies with its DOCTYPE definition.
With these concepts in mind, we can define "markup validation" as the process of checking a web page against the grammar it claims to be using.
Adapted from the W3C Validation service
Checkpoint 3.2 requires that documents validate to published formal grammars. The most common DOCTYPE definitions are:
There are some simple things you can do to ensure that your documents validate.
Ensure that all pages include a DOCTYPE definition in the first line of code
Correct
Incorrect:
Ensure that all relevant tags are closed properly.
Correct:
Incorrect:
In XHTML, make sure you self-close tags when they don't have end tags.
Correct:
Incorrect:
Don't transpose tags. Make sure you close tags in the order they are opened.
Correct:
Incorrect:
Don't nest block level elements inside inline elements.
Correct:
Incorrect:
Don't omit compulsory tags, even if the web page displays properly without them.
Correct:
Incorrect:
Escape relevant entities.
Correct:
Incorrect:
The W3C maintains a validation service that can test a site one page at a time via URL or page upload. Alternatively, you can use the WDG HTML Validator to validate your entire site.
There are many common errors of invalid sites. The W3C Validation service maintains a list of errors and their meanings. This document can assist in determining errors if they occur.
No DOCTYPE found! Attempting validation with XHTML 1.0 Transitional.
The DOCTYPE Declaration was not recognized or is missing. This probably means that the Formal Public Identifier contains a spelling error, or that the Declaration is not using correct syntax. Validation has been performed using a default "fallback" Document Type Definition that closely resembles "XHTML 1.0 Transitional", but the document will not be valid until you have corrected this problem with the DOCTYPE Declaration.
Lean how to add a doctype to your document from our FAQ.
This error is caused when the page hasn't specified a DOCTYPE definition, or if this definition is in the wrong place in the document. The DOCTYPE definition always has to be the first line of code.
Error Line 190 column 79: required attribute "alt" not specified .
…._images/home/sale/sale-static2.gif" / > </a><div style="width: 271px; height: 6
The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.
This error is caused by a missing ALT attribute in an IMG tag.
Error Line Line 332 column 131: end tag for "img" omitted, but OMITTAG NO was specified.
….e/products/get_into_business.gif"></a > </td></tr>
You may have neglected to close an element, or perhaps you mean to "self-close" an element, that is, ending it with "/>" instead of ".".
Although the error highlights the </a> tag, this error occurred because the web page had a DOCTYPE definition of XHTML Transitional. This DOCTYPE definition requires, in this instance that the IMG tag ends with a self-closing tag, ie: />
Error Line 719 column 118: there is no attribute "onMouseOver".
…ormation' target="_self' onMouseOver= ' self.status='Carry-on Baggage'; return
You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (eg., you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).
This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.
How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.
Some DOCTYPE definitions forbid certain elements, for example, this web page has a DOCTYPE definition of XHTML Transitional. The attribute ONMOUSEOVER is forbidden in this DOCTYPE.
Error Line 48 column 59: value of attribute "ID" invalid: "_" cannot start a name.
<form name="_ct10" method="post" action="default.aspx" id=" _ ct10">
It is possible that you violated the naming convention for this attribute. For example, id and name attributes must begin with a letter, not a digit.
Certain attributes must follow certain rules. In this example, the attribute ID begins with an underscore. The attribute ID must only begin with a letter.
Error Line 103 column 381: end tag for element "TD" which is not open.
…/" target=" ">Who\ 's who</a></div></td > </tr></table></div><div class="herotime
This error occurs when a start tag is missing, or an extra end tag has been included.
Error Line 17 column 48: ID "LOGIN_USER" already defined.
…UT type="password" class="input" id=" login_user" style="width:80±;" name="lo
An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).
This error occurs when an ID has already been defined earlier in the document. This is often the case when a field ID is not unique.
Last updated: 1 July 2007
Enter your email address to subscribe or unsubscribe from the eGov What's New mailing list.
Please enter email address of the person you wish to send this page to.