No replies
thepineapplehead's picture
Milton Keynes
Last seen: 14 weeks 4 days ago
Milton Keynes
Joined: 2004-06-30
Posts: 9668
Points: 801

I thought it would be a good idea to post some common validation errors, what they mean, and how to fix them.

No background-color

  • Line : 12 (Level : 1) You have no background-color with your color : a:link
  • Line : 20 (Level : 1) You have no background-color with your color : a:visited
  • Line : 20 (Level : 1) Same colors for color and background-color in two contexts body and a:visited
  • Line : 28 (Level : 1) You have no background-color with your color : a:hover

This is a new one. Basically, wherever you specify a color or the font, you shoudl specify a background color, to sensure there is enough contrast for it to be read; for example, if you use a white text, with a blue background image, and a white body background - if the background image breaks, the text will become unreadable.

No document type declaration


Error Line 1, column 0: no document type declaration; implying "<!DOCTYPE HTML SYSTEM>"

<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8">< The checked page did not contain a document type ("DOCTYPE") declaration. The Validator has tried to validate with the HTML 4.01 Transitional DTD, but this is quite likely to be incorrect and will generate a large number of incorrect error messages. It is highly recommended that you insert the proper DOCTYPE declaration in your document -- instructions for doing this are given above -- and it is necessary to have this declaration before the page can be declared to be valid.

One of my favourites. Pages need doctypes to validate. Pages need FULL doctypes to force IE into Standards Mode.

A doctype is a Document Type definition, which tells the browser what version of HTML you have coded the page in. At the moment, there are three flavours - Html 4.01, Xhtml 1.0, and Xhtml 1.1.

Of these, there are three subsets - strict, transitional, and frameset When converting legacy pages, it's best to stick with HTML4.01, or at least a transitional DTD. However, when creating new CSS-based layouts, it's good practice to use a strict DTD.

For more information on the DTD, please visit

TYPE not specified


Error Line 1, column 106: required attribute "TYPE" not specified"><title>Google</title><style> 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>.

The validator picks up that you have not declared a type for whatever you are using - either CSS or JavaScript. As it says in the italics, you need to add the type in:

<style> becomes <style type="text/css">
<script> becomes <script type="text/javascript">

Attribute Value must be a Literal

Error Line 4, column 29: an attribute value must be a literal unless it contains only name characters

</style></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b ali

You have used a character that is not considered a "name character" in an attribute value. Which characters are considered "name characters" varies between the different document types, but a good rule of thumb is that unless the value contains only lower or upper case letters in the range a-z you must put quotation marks around the value. In fact, unless you have extreme file size requirements it is a very very good idea to always put quote marks around your attribute values. It is never wrong to do so, and very often it is absolutely necessary.

This is a simple one. Although the <body> styles are deprecated in favour of CSS styling, I will still explain how to fix this error. You need to wrap all attributes in "speech marks". Easy Laughing out loud

There is no attribute "..."

ErrorLine 4, column 101: there is no attribute "TOPMARGIN" alink=#ff0000 topmargin=3 marginheight=3><table border=0 cellspa

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 (e.g. 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.

Another simple one. This error occurs when you try to use an attribute that is deprecated in the Doctype you've set. In Google's case, there is no doctype, so the validator falls back to 4.01.

To fix errors like these, use the CSS equivalent margin-top: xxx; on the body selector.

Reference for Entity


Error Line 13, column 285: reference to entity "tab" for which no system identifier could be generated


This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text. See the previous message for further details.

Info Line 4, column 345: entity was defined here


This usually happens in generated links to other pages. The validator will highlight the rebel character in red, in the bit starting entity was defined here. In this case, the Ampersand is the offending code.

The fix is simple - replace the characters with their HTML equivalent.

&amp; for &
&gt; for >
&lt; for <

End tag for "..." omitted


Error Line 49 column 45: end tag for "input" omitted, but OMITTAG NO was specified.

<input type="hidden" name="ie" value="UTF-8"> You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Info Line 49 column 0: start tag was here.

<input type="hidden" name="ie" value="UTF-8">

OMITTAG NO is a command that allows you to omit the end tag of elements, which is necessary for XHTML to validate. If you are using an XHTML doctype, and see this error, it means one or more of your elements are not closed. To close them, use a space and a forward slash before the final > for example, <br> becomes <br />.

The Info code tells you which tag is unclosed.

ID "..." already defined


Error Line 41 column 36: ID "last" already defined.

<li> <a href="dec.html" id="last">Dec</a></li> 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).

Info Line 22 column 40: ID "last" first defined here.

<li> <a href="contact.html" id="last">Contact</a></li>

The error is exactly what the validator is telling you. You can only use IDs once per page; if you need a reuse, consider using .classes instead.

End tag for element "..." which is not open


Error Line 49 column 9:end tag for element "td" which is not open.

</td> The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

If this error occured in a script section of your document, you should probably read this FAQ entry.

You have closed a tag which you haven't opened. Check through your markup and ensure there are the same number of opening tags as there are closing tags.

Verschwindende wrote:
  • CSS doesn't make pies