Sp 65

From Htmlpedia
Jump to: navigation, search

OpenSP: Document type does not allow element ... here; missing one of ... start-tag

Cause:

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

There are 2 types of elements in the body of a HTML file, inline and block elements. 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>").

In the following sample, the <font> tag is an inline tag which can only contain other inline tags. But the <p> tag is a block tag. So a <p> tag can not be contained in a <font> tag.

Example:

Bad<font size=2><p>abc</p></font>
Good<p><font size="2">abc</font></p>
Good<p style="font-size: 80%">abc</p>

Solution:

Move inline tags into block elements.

But the W3 validator marks as error:

Bad<p class="content">~~~<p>abc</p></p>

The outer <p> has to be replaced by <div>

References: