Skip to main content
HTML Validation

The “name” attribute is never allowed on the “b” element.

About This HTML Issue

The name attribute is not a valid attribute for the <b> element in HTML.

<b> only takes the global attributes, and name is not one of them. HTML defines name on a handful of elements, mostly form controls, <form>, <iframe> and <meta>. The validator reports it twice on <b>: this warning, and an error saying that the attribute is not allowed on b at this point. Removing the attribute clears both.

name on <b> is often left over from an old anchor pattern. <a name="..."> used to mark a spot that links could jump to, and people copied the attribute onto other elements. It doesn't work there. To resolve a fragment such as #shipping, browsers look for an element with that id, and the only name they check is the one on <a>. So a link to #shipping won't scroll to <b name="shipping">.

Change name to id and the link works, as long as the value is unique on the page. If the value is only there for scripts, put it in a data-* attribute such as data-name, and update any script that finds the element with document.getElementsByName() to use getElementById() or a [data-name] selector.

Invalid example

<p><a href="#shipping">Shipping costs</a></p>
<p><b name="shipping">Shipping</b> is free on orders over 50 euros.</p>

Valid example

<p><a href="#shipping">Shipping costs</a></p>
<p><b id="shipping">Shipping</b> is free on orders over 50 euros.</p>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries