|
Posted by Jonathan N. Little on 05/19/06 01:38
In article <Dy2bg.22352$Qq.16523@clgrps12>, nowhereman@twilightzone.net
says...
> (Sound of grinding teeth. . .)
> I've solved my previous hyperlink issue in IE with the following:
>
> <body>
> <a name="top" id="top"> </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"> </a>The mentioned element is not allowed to
<snip>
> 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.
You need to learn how to read the error message. Look at the spec for the
BODY element
http://www.w3.org/TR/html4/struct/global.html#edef-BODY
<!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body -->
^^^^^^^^^^^^^^^
This tells what elements can follows (immediate child) the BODY opening
tag.
a block element or the SCRIPT element and that is all. A element is NOT a
block but an inline-element so therefore the error message lists for you
what element opening tag must precede the A element after the BODY.
<body><some_block_element_tag><a name="something">...
--
Jonathan
Navigation:
[Reply to this message]
|