HTML on-page links not working

HTML bookmarks, or on-page link targets, are used often so viewers can easily jump to another section on a page. The link would be in this form: <a href="#hello">. Then define the bookmark with code like this: <a name="hello">

These links have stopped working if you use the wrong HTML code. Used to be you could use <a name="hello"></a> or <a id="hello"></a> but you can now only use the id attribute for this.

name= is deprecated for link targets, and invalid for links in HTML5. It no longer works at least in latest Firefox (v13). Change <a name="hello"> to <a id="hello">

The target does not need to be an <a> tag, it can be <p id="hello"> or <h2 id="hello"> etc. which is often cleaner code.

name= is still used (needed) in forms. It is also still needed in META tags.


Posted

in

by

Tags:

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.