About This HTML Issue
The name attribute is not a valid attribute for the <span> element in HTML.
The name attribute exists on specific elements like <a>, <form>, <input>, <map>, <meta>, <iframe>, <object>, and <param>. It was never part of the <span> element's specification. In older HTML practices, <a name="section"> was used to create anchor targets within a page, and some developers incorrectly applied the same pattern to <span> elements.
To create an anchor target on a <span> or any other element, use the id attribute instead. The id attribute is a global attribute, valid on every HTML element, and works as a fragment identifier in URLs (e.g., page.html#section-name).
If the name attribute was being used for JavaScript targeting or styling, switch to id, class, or data-* attributes depending on the use case.
Invalid example
<span name="intro">Welcome to the site.</span>
Valid examples
Use id to create a linkable anchor target:
<span id="intro">Welcome to the site.</span>
Use class when multiple elements share the same label:
<span class="intro">Welcome to the site.</span>
Use a data-* attribute for custom metadata consumed by JavaScript:
<span data-name="intro">Welcome to the site.</span>
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.