Forum Moderators: open
Line 43, Column 317: document type does not allow element "a" here; missing one of "object", "span", "bdo", "applet", "iframe", "tt", "i", "b", "u", "s", "strike", "big", "small", "font", "em", "strong", "dfn", "code", "q", "samp", "kbd", "var", "cite", "abbr", "acronym", "sub", "sup", "label", "ins", "del" start-tag
…r: #3B5998; text-decoration: none;"/>Personal Name</a><br/>
<a href="http://www.facebook.com/accountname" title="Personal Name" target="_TOP"/><img src="" width="120" height="136" alt="alt" style="border: 0px;" /><br/><a href="" title="Make your own widget!" target="_TOP" style="font-family: "lucida grande",tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;"/>Create Your Widget<!-- END --> Thanks for the help
[edited by: tedster at 4:33 am (utc) on Nov. 4, 2009]
[edit reason] remove personal url and name [/edit]
The error:
document type does not allow element "a" here;
Means exactly what it says. You have an "a" element inside of an element that does not allow "a" elements. In this particular case, you have an "a" inside of an "a". I suspect that it's simply missing a closing </a> tag before that <br/> tag.
[edited by: tedster at 1:11 am (utc) on Nov. 4, 2009]
To avoid any misinterpretation would you please be so kind as to amend the code from Josh's post and repost it so that it includes your suggestion?
It's my page that Josh is kindly helping to validate (I'm a clueless amateur but am learning fast!), and we're still stuck on this one last little error and we can't quite yet seem to get it validated despite your kind recommendation.
Sorry for any inconvenience caused by my request, but if you could 'spell it out' for us I would be forever thankful!
Warm regards
Peter
I plugged in an XHTML strict DTD and got more like 8 errors.
1) Any kind of wrapper around the section will take care of the error noted. A <div> </div> will work just fine.
document type does not allow element "a" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag…http://www.example.com" title="x x x">
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.
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>").
2) If it hasn't yet, it will throw the same error for the <br />
3) <a> is not properly opened or closed;
<a href="http://www.example.com" title="x x x" target="_TOP"/><img src="" width="120" height="136" alt="alt" style="border: 0px;" />
Correct is to drop the closing slash in opening of the tag. You are opening the <a> only.
You can also streamline the markup. Why separate width: and height: from the style? Why not put it all in the CSS. Much easier to follow down the road.
Correct (mostly - see #4):
<a href="http://www.example.com" title="x x x" target="_TOP">
<img src="aaa.jpg" alt="alt" style="border-width: 0; width: 120px; height: 136px;" />
</a>
4) target="_TOP" will NOT validate. Target is deprecated in XHTML and you are using XHTML closing tags, so presuming XHTML DTD.
5) font can be shorthanded which will make it a lot easier to follow.
font: normal normal normal 11px "lucida grande", tahoma, verdana, arial, sans-serif;
~ ~ ~ Thought it very interesting that CSS threw up 'Parse Error [empty string'] - with "lucida grande", but required " - I've not seen that before. Anybody with some tips on that? Why? Other fonts that this affects in CSS declarations?
I'm so used to external stylesheets or embedding that I never gave a thought to the fact that it was an inline declaration and that actual quotes would be a problem.
What I was thinking was:
CSS:
<style type="text/css" media="screen">
a.font {
font: normal normal normal 11px "lucida grande", tahoma, verdana, arial, sans-serif; color: #3b5998; text-decoration: none;
}
</style>
HTML:
<a href="" class="font" title="Make your own widget!">
Create Your Widget
</a>
[edited by: tedster at 4:35 am (utc) on Nov. 4, 2009]