Skip to main content

HTML Guide

The “name” attribute is obsolete. Consider putting an “id” attribute on the nearest container instead.

In the days before HTML5, named anchors were used as a way to provide a link to a specific section of a document, for example:

<h2>
  <a name="section-5">Section 5</a>
</h2>

Now in HTML5, the name attribute is obsolete for <a> tags, and instead, you can use the id attribute of any element (not just <a>) as a way to navigate directly to it, for example:

<h2 id="section-5">Section 5</h2>

Learn more:

Related W3C validator issues