Reputation: 7105
I am wondering if there is a correct way to implement the anchor tag as I have seen the following examples <p id="somename">text</p>
, <h1 id="someheader">header</h1>
, etc
This then referenced as <a href="#somename">Link</a>
or <a href="#someheader">Link</a>
. I am aware that an anchor can also implemented as <p><a name="somename"></a>text</p>
.
Aside from the ID attribute being used for CSS and Javascript, would it still be considered acceptable to use the ID attribute as an anchor? What other issues can there be?
Upvotes: 0
Views: 1170
Reputation: 944321
Aside from the ID attribute being used for CSS and Javascript, would it still be considered acceptable to use the ID attribute as an anchor?
Yes. Using an id is the modern approach. It is a generic way to identify part of a document. Being able to reuse it for other things (CSS, JS, etc) that need to identify part of a document is an advantage).
What other issues can there be?
It isn't supported by Netscape 4 (which you probably shouldn't care about).
Upvotes: 3