You are here: Page won't validate -- misuse of A element? « HTML « IT news, forums, messages
Page won't validate -- misuse of A element?

Posted by Michael Laplante on 05/18/06 20:55

(Sound of grinding teeth. . .)
I've solved my previous hyperlink issue in IE with the following:

<body>
<a name="top" id="top">&nbsp;</a>

-- page content --

<div style="text-align: center">
<a href="#top">Back to top</a>
</div>

I've set the doc type to HTML4.01 strict. When I go to validate it though I
get this:

***
Below are the results of attempting to parse this document with an SGML
parser.

1.. Error Line 11 column 26: document type does not allow element "A"
here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV",
"ADDRESS" start-tag.
<a name="top" id="top">&nbsp;</a>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>").

***

Why is <a> not allowed here? It's the first bit of code after <body> and
there is no block-level element contained within it, so what's the issue
here? Must it be enclosed in a <P> or other block level element to validate?
(I'm about to go off and do this but nothing on the w3 reference suggests
this is a necessity.)

FWIW, the WDG validator gave me a similar message.



M

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация