Search code examples
htmlw3cobsolete

If <a name="..."> is obsolete, what is preferred?


The HTML code <a name="some_bookmark">text</a> is very useful for creating links to specific sections of a page (e.g., page.html#some_bookmark). However, the W3C spec now marks the name attribute of the a tag as "obsolete."

If this is the case, then what is preferred? Is there a new <bookmark> tag or similar?


Solution

  • You can place an id="" attribute on any element and it will have the same effect.

    These are typically placed on heading elements.