Forum Moderators: open
The above is from lists.w3.org, and is dated back in 1999.
I take this to mean the following:
<a name="foo" id="foo" href="#">bar</a> My question is, does this convention apply in today's standards of development, or is enough to simply use the method below:
<a id="foo" href="#">foobar</a> The line of reasoning is that the older user agents referred to in the article must certainly be out of existence by now, and more standards compliant browsers, at least to this standard, anyway, must by now be the norm. Can we drop the 'name='?
I know that name has been deprecated (except in form fields of course), but what I was wondering is how good the support is for using id in non-anchor tags as fragment identifiers.
I seem to remember trying it not so long ago and finding some browsers that didn't work. I can't remember, though, if I was trying to support NS4.x on those pages or not.
Tom
The name attribute is deprecated in HTML 4.01 Strict and above so you won't be able to use it.
I may be missing the point, but that does not seem to fit in with my experience. I use
<a name="tag"> extensively and none of the validators complain about it. The following test file validated to 4.01 Strict with Tidy, W3C and WDG validators:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/REC-html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Test of named anchor</title>
</head><body>
<H1>Main Header</H1><H2>Table of contents</H2>
<UL>
<LI> <A HREF="#tag">The second level header</A>
</UL><H2>[b]<A NAME="tag"></A>[/b]Second level header</H2>
<P>Some text.
</body>
</html>
I may be missing the point, but that does not seem to fit in with my experience.
You are correct, my mistake. I've been working mostly in XHTML 1.1 so I'm up against a slightly different set of deprecated elements with the name attribute being one of them.
<div><a name="example">Named Anchor</a></div> So, my above statement only applies to XHMTL 1.1...
Changes from XHTML 1.0 Strict [w3.org]
<edit>Corrected grammer.
[edited by: pageoneresults at 3:46 am (utc) on Mar. 12, 2004]
So, my above statement only applies to XHMTL 1.1...
Since I am thinking of maybe going to XHTML one day this is very valuable info, thanks!
I never knew, until this thread, that it was possible to use
<h2 id="woot">Wheeeeeee!</h2> as a target, so I have already learned a lot already from this thread. So much knowledge out there :) ; so little brain in which to store it :( .