Re: Problems with Markup Validation

Sandra Reinhart wrote:

> I am the webmaster of - I have several
> problems validating our design.

It’s not too bad—only 4 validation errors.

In general, it is best to work with validation errors sequentially, fixing 
the first one first, and so on. Quite often, one error spawns other error 
messages, which vanish in a puff of logic, when you fix the first error. 
Well, maybe not in this case, but generally.

The first message relates to line 53 and is caused by a homeless <li> 
element. An <li> element may only occur as a child of <ul> or <ol>. If there 
is no real list involved, use <span> or <div>, or just style an element like 
<a> directly.

> I do not understand the following error:
> Line 69, Column 20: document type does not allow element "div" here;
> missing one of "object", "applet", "map", "iframe", "button", "ins",
> "del" start-tag
>  <div class="logo"></div>

The reason is that the preceding tag is an <a> tag, so the <div> element 
would appear inside an <a> element, which is forbidden by syntax rules. You 
can change the <div> element to a <span> element to avoid the issue, but you 
may need to revise your CSS code accordingly.

> One possible cause for this message is that you have attempted to put
> a block-level element (such as "<p>" or "<table>") inside an inline
> element (such as "<a>", "<span>", or "<font>").

There it is - your block-level element is <div>.

Another type of error message is caused by the use of good old style <img> 
markup in a document that declares an XHTML doctype. If you play XHTML, then 
you need to ”self-close” so-called empty elements (elements with EMPTY 
declared content) using the ”/” character before ”>”: <img src="..." ... 
alt="..." border="0"/>


Received on Thursday, 2 September 2010 17:01:38 UTC