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

Posted by Jukka K. Korpela on 05/18/06 21:06

Michael Laplante <nowhereman@twilightzone.net> scripsit:

> I've solved my previous hyperlink issue in IE with the following:
>
> <body>
> <a name="top" id="top">&nbsp;</a>

Which issue? There is no problem here before you decide to create one.
First, "Back to top" links are not needed - they are in fact harmful, see
http://www.cs.tut.fi/~jkorpela/www/totop.html
Besides, even if users needed such links, you could set them up using just
href="#", without artificial constructs.

> I've set the doc type to HTML4.01 strict.

Do you know what that means?

> <a name="top" id="top">&nbsp;</a>The mentioned element is not
> allowed to appear in the context in which you've placed it;

Isn't this rather obvious? The <a> element is allowed where it is. Now just
check the HTML 4.01 Strict syntax. It does not allow <a> elements directly
insider <body>.

> 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?

It's not _contained in_ a block-level element?

> Must it be enclosed in a <P> or other block level
> element to validate?

Bingo. But it's not a paragraph, so <p> would be semantically wrong. So
<div> would fix the syntactic issue. So would removing the useless <a>
element.

> (I'm about to go off and do this but nothing on
> the w3 reference suggests this is a necessity.)

Really? Not even the HTML 4.01 specification?

 

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

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