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

wchargin picture wchargin · Jun 7, 2013 · Viewed 12.1k times · Source

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?

Answer

SLaks picture SLaks · Jun 7, 2013

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

These are typically placed on heading elements.