HTML Guides
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
A <label> element that wraps a form control, such as an <input> or a <select>, can't have an aria-hidden attribute, whatever its value.
aria-hidden="true" removes an element and everything inside it from the accessibility tree. When a <label> contains a labelable element (button, meter, output, progress, select, textarea, or an input of any type except hidden), hiding the label hides the control too. Keyboard users can still tab to the field, but a screen reader has nothing to announce when they get there, not even the label text that should give the control its name.
The validator reports the attribute on these labels with any value, including aria-hidden="false", so remove it instead of changing it. If the label also points to the control with a for attribute, a second error says the label is associated with a labelable element.
Remove aria-hidden from the <label>. When only part of the label is decorative, such as an icon or the asterisk that marks a required field, put aria-hidden="true" on a <span> around that part. A visually hidden CSS class keeps label text off the screen so that only screen readers read it, and aria-hidden on the same label cancels that. If the whole field has to stay hidden from everyone, as with a spam trap field, put aria-hidden="true" on an element that wraps the label and add tabindex="-1" to the control so keyboard users can't reach it.
Invalid example
<label aria-hidden="true">
Email <span class="required">*</span>
<input type="email" name="email" required>
</label>
Valid example
<label>
Email <span class="required" aria-hidden="true">*</span>
<input type="email" name="email" required>
</label>
An aria-hidden attribute on a <label> element that is associated with a form control hides the label from assistive technologies while the control still expects an accessible name from it. This creates a broken association where the form field appears unlabeled to screen readers.
The aria-hidden="true" attribute removes an element and all its descendants from the accessibility tree. When a <label> is linked to an input (either by wrapping it or through the for attribute), the browser uses that label to compute the input's accessible name. Setting aria-hidden="true" on the label strips away that name, leaving the input without a label for assistive technology users.
The HTML spec explicitly forbids this combination because it guarantees an accessibility failure. A label that exists visually but is hidden from the accessibility tree defeats its own purpose.
To fix this, remove aria-hidden from the <label>. If the label text should not be visible on screen, use a CSS technique to visually hide it while keeping it accessible. If the label itself is truly decorative and another mechanism provides the accessible name (like aria-label on the input), remove the for/id association so the <label> is no longer linked to the control.
Incorrect example
<label for="email" aria-hidden="true">Email</label>
<input type="email" id="email">
Correct examples
Remove aria-hidden from the label:
<label for="email">Email</label>
<input type="email" id="email">
If the goal is to visually hide the label while keeping it accessible, use CSS instead:
<label for="email" class="visually-hidden">Email</label>
<input type="email" id="email">
<style>
.visually-hidden {
clip: rect(0 0 0 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
</style>
If the label is decorative and the input gets its accessible name from another source, break the association:
<label aria-hidden="true">Email</label>
<input type="email" aria-label="Email">
The aria-invalid attribute belongs on the role="radiogroup" element that wraps the options, not on each role="radio" option inside it.
WAI-ARIA 1.2 deprecated aria-invalid as a global state, and future versions will only allow it on the roles that support it: application, checkbox, combobox, gridcell, listbox, radiogroup, slider, spinbutton, textbox and tree, plus the roles that inherit from them. radio isn't on that list. A radio button's validity depends on the whole group. A required choice is either made or missing, and no single option is wrong by itself.
Browsers and screen readers aren't required to expose a state on a role that doesn't support it, so an error set on the options may never reach the user.
The validator flags any element with an explicit role="radio" and an aria-invalid attribute, whatever its value, so aria-invalid="false" triggers the warning too. Native <input type="radio"> elements aren't flagged. To fix it, remove the attribute from every option and set it on the radiogroup container. Point aria-describedby on that container at the error message, so screen readers announce it along with the group's label.
Invalid example
<p id="plan-label">Choose a plan</p>
<div role="radiogroup" aria-labelledby="plan-label">
<div role="radio" aria-checked="false" aria-invalid="true" tabindex="0">Basic</div>
<div role="radio" aria-checked="false" aria-invalid="true" tabindex="-1">Pro</div>
</div>
<p id="plan-error">Select a plan to continue.</p>
Valid example
<p id="plan-label">Choose a plan</p>
<div role="radiogroup" aria-labelledby="plan-label" aria-invalid="true" aria-describedby="plan-error">
<div role="radio" aria-checked="false" tabindex="0">Basic</div>
<div role="radio" aria-checked="false" tabindex="-1">Pro</div>
</div>
<p id="plan-error">Select a plan to continue.</p>
An aria-label attribute on an <a> element is only valid when the link has an accessible role that supports naming — which means the <a> must have an href attribute or an explicit role that accepts a label.
When an <a> element lacks an href attribute, it has the implicit role of generic. The generic role is in the list of roles that do not support naming, so applying aria-label to it is invalid. This is because a generic element has no semantic meaning, and screen readers wouldn't know how to announce the label in a meaningful way.
The most common cause of this error is using <a> as a placeholder or JavaScript-only trigger without an href. An <a> with an href has the implicit role of link, which does support aria-label, so the error won't appear.
You have a few ways to fix this:
- Add an
hrefto make it a proper link (most common fix). - Add an explicit role that supports naming, such as
role="button", if the element acts as a button. - Use a
<button>instead if the element triggers an action rather than navigation. - Remove
aria-labelif it's not needed, and use visible text content instead.
HTML Examples
❌ Invalid: aria-label on an <a> without href
<a aria-label="Close menu" onclick="closeMenu()">✕</a>
The <a> has no href, so its implicit role is generic, which does not support naming.
✅ Fix option 1: Add an href
<a href="/close" aria-label="Close menu">✕</a>
✅ Fix option 2: Use a <button> instead
<button aria-label="Close menu" onclick="closeMenu()">✕</button>
✅ Fix option 3: Add an explicit role that supports naming
<a role="button" tabindex="0" aria-label="Close menu" onclick="closeMenu()">✕</a>
Using a <button> (option 2) is generally the best choice for interactive elements that perform actions rather than navigate to a URL.
A <b> element without an explicit role has the generic role, and generic elements can't have an accessible name, so aria-label is not allowed on it.
ARIA forbids naming elements with the roles listed in the message. Screen readers often skip an aria-label on these elements, and users never hear it. Setting role="generic" or role="presentation" on the <b> doesn't help either, because both roles are in the list.
The usual cause is a <b> used as a clickable icon, such as the "×" that closes a notice. Keyboard users can't tab to a <b>, and screen readers don't announce it as a button. Replace it with <button type="button">, which takes aria-label, receives focus, and runs its click handler when the user presses Enter or Space.
Adding aria-hidden="true" doesn't clear the message. The validator still flags the aria-label, and nobody hears the label of a hidden element anyway. For a purely decorative <b>, keep aria-hidden="true" and delete aria-label. If the <b> is a symbol that means something by itself, like an asterisk that marks a required field, role="img" makes the label valid. For ordinary bold text, remove aria-label and reword the visible text if it isn't clear enough on its own.
Invalid example
<div class="alert" role="status">
<p>Your changes have been saved.</p>
<b class="alert-close" aria-label="Dismiss message" onclick="this.parentElement.hidden = true">×</b>
</div>
Valid example
<div class="alert" role="status">
<p>Your changes have been saved.</p>
<button type="button" class="alert-close" aria-label="Dismiss message" onclick="this.parentElement.hidden = true">×</button>
</div>
A div element without an explicit role resolves to the generic role, which does not support naming — so adding aria-label to a plain div is invalid.
The aria-label attribute provides an accessible name for an element, but not every element is allowed to have one. The ARIA specification defines certain roles as "naming prohibited," meaning assistive technologies will ignore any accessible name applied to them. The generic role is one of these, and since a div without an explicit role attribute defaults to generic, the aria-label is effectively meaningless.
To fix this, you have two main options: assign an appropriate ARIA role to the div so it becomes a nameable landmark or widget, or switch to a semantic HTML element that already carries a valid role. Common roles that support naming include region, group, navigation, alert, and many others.
If the div is truly just a generic wrapper with no semantic meaning, consider whether aria-label is even needed. Perhaps the label belongs on a child element instead, or the content is already self-describing.
HTML Examples
❌ Invalid: aria-label on a plain div
<div aria-label="User profile section">
<p>Welcome, Jane!</p>
</div>
✅ Fix: Add an appropriate role
<div role="region" aria-label="User profile section">
<p>Welcome, Jane!</p>
</div>
✅ Fix: Use a semantic element instead
<section aria-label="User profile section">
<p>Welcome, Jane!</p>
</section>
The aria-label attribute cannot be used on an <i> element with its default implicit role (generic), because generic elements are not allowed to have accessible names.
The <i> element has an implicit ARIA role of generic, which is one of the roles explicitly prohibited from carrying an aria-label. This restriction exists because screen readers and other assistive technologies ignore accessible names on generic containers — so adding aria-label to a plain <i> element would silently fail to convey any meaning to users who rely on assistive technology.
This issue commonly appears when icon fonts (like Font Awesome) use <i> elements as decorative icons. If the icon is purely decorative, you should hide it from assistive technology with aria-hidden="true" and place the accessible label on a parent or sibling element instead. If the icon conveys meaning on its own, you can assign an appropriate role like role="img" so the aria-label is actually announced.
HTML Examples
❌ Invalid: aria-label on a plain <i> element
<button>
<i class="icon-search" aria-label="Search"></i>
</button>
✅ Fix 1: Decorative icon — hide it, label the parent
<button aria-label="Search">
<i class="icon-search" aria-hidden="true"></i>
</button>
✅ Fix 2: Meaningful icon — assign role="img"
<button>
<i class="icon-search" role="img" aria-label="Search"></i>
</button>
The aria-label attribute cannot be used on a custom element like <menu-item> when it has no explicit role attribute, because it defaults to the generic role, which is in the list of roles that prohibit aria-label.
Custom elements without an explicit role are treated as having the generic role (equivalent to a <span> or <div> in terms of semantics). The WAI-ARIA specification prohibits aria-label on several roles, including generic, because naming these elements creates a confusing experience for assistive technology users — a generic container with a label doesn't convey any meaningful purpose.
To fix this, you need to assign a meaningful role to the <menu-item> element that supports accessible naming. Common choices include role="menuitem", role="link", or role="button", depending on what the element actually does. Since this appears to represent a menu item that navigates to a page, role="menuitem" is likely the most appropriate.
HTML Examples
❌ Invalid: aria-label on an element with implicit generic role
<menu-item
submenu-href="/page"
label="some label"
submenu-title="some submenu title"
aria-label="some aria label">
</menu-item>
✅ Valid: adding an explicit role that supports aria-label
<menu-item
role="menuitem"
submenu-href="/page"
label="some label"
submenu-title="some submenu title"
aria-label="some aria label">
</menu-item>
If the aria-label isn't actually needed (for example, if assistive technology already receives the label through other means in your component), another valid fix is to simply remove aria-label entirely.
A <pre> element has the implicit role generic, which can't have an accessible name, so aria-label on a plain <pre> is an error.
The ARIA specification prohibits names on the roles listed in the message. Screen readers ignore a name set on any of them, so the label never reaches the user. A <pre> without a role attribute counts as generic, and the validator rejects its aria-label until the element has a role from outside that list.
The fix depends on what the <pre> holds. ASCII art and text diagrams are pictures made of characters, and a screen reader reads them out one symbol at a time. Add role="img" so the aria-label replaces that string of symbols with a description. Don't do this for code: the img role hides the element's text, and screen reader users would hear the label instead of the code.
For a code block, a visible caption helps sighted readers too. Wrap the <pre> in a <figure>, put the description in a <figcaption>, and remove the aria-label. If the code block scrolls and has tabindex="0" so keyboard users can scroll it, role="region" gives that focus stop a name and makes the aria-label valid.
Invalid example
<pre aria-label="A cup of coffee drawn with text characters">
( (
) )
........
| |]
\ /
`----'
</pre>
<pre aria-label="Calculating the order total"><code>const total = price * quantity;</code></pre>
Valid example
<pre role="img" aria-label="A cup of coffee drawn with text characters">
( (
) )
........
| |]
\ /
`----'
</pre>
<figure>
<figcaption>Calculating the order total</figcaption>
<pre><code>const total = price * quantity;</code></pre>
</figure>
A span element has an implicit ARIA role of generic, and the aria-label attribute is not allowed on elements with that role.
The span element is a generic inline container with no semantic meaning. Its default ARIA role is generic, which is one of several roles that prohibit naming via aria-label or aria-labelledby. This restriction exists because screen readers are not expected to announce names for generic containers — adding aria-label to them creates an inconsistent and confusing experience for assistive technology users.
To fix this, you have two main options:
- Assign an explicit role to the
spanthat supports naming, such asrole="img",role="group",role="status", or any other role that allowsaria-label. - Use a different element that already has a semantic role supporting
aria-label, such as abutton,a,section, ornav.
If the span is purely decorative or used for styling, consider using aria-hidden="true" instead and placing accessible text elsewhere.
HTML Examples
❌ Invalid: aria-label on a plain span
<span aria-label="Close">✕</span>
✅ Fixed: assign an appropriate role
<span role="img" aria-label="Close">✕</span>
✅ Fixed: use a semantic element instead
<button aria-label="Close">✕</button>
✅ Fixed: hide the decorative span and provide text another way
<button>
<span aria-hidden="true">✕</span>
<span class="visually-hidden">Close</span>
</button>
The <time> element does not support the aria-label attribute when it has no explicit role or when it carries certain generic roles.
The <time> element has an implicit ARIA role of time, but this role is not listed among those that allow aria-label. According to the ARIA in HTML specification, aria-label is only permitted on elements with roles that support naming from author — and the default role of <time> (as well as roles like generic, presentation, paragraph, and others listed in the error) does not qualify.
In practice, the <time> element already conveys its meaning through its visible text content and the machine-readable datetime attribute. Screen readers use the visible text to announce the date, so aria-label is typically unnecessary.
To fix this, simply remove the aria-label attribute and ensure the visible text content is descriptive enough. If you need to provide a more accessible reading of the date, you can adjust the visible text itself or wrap the element with a <span> that has an appropriate role.
Also note the original code has a missing space before datetime — the attribute must be separated from class="Tag" by a space.
HTML Examples
❌ Invalid: aria-label on <time>
<time aria-label="Apr 2." class="Tag" datetime="2026-04-02">
Apr 2.
</time>
✅ Fixed: Remove aria-label and use clear visible text
<time class="Tag" datetime="2026-04-02">
April 2, 2026
</time>
If you truly need aria-label, you can assign an explicit role that supports naming, such as role="text", though this is rarely necessary:
<time role="text" aria-label="April 2nd, 2026" class="Tag" datetime="2026-04-02">
Apr 2.
</time>
The aria-label attribute is not allowed on a <label> element when that <label> contains a labelable element (such as <input>, <select>, <textarea>, or <button>).
The <label> element already provides an accessible name for its associated form control through its text content. When a <label> wraps a labelable element, adding aria-label to the <label> creates a conflict: the <label> has one accessible name (from aria-label) while the form control inside it derives its accessible name from the <label>'s text content. Assistive technologies may handle this inconsistency unpredictably.
The HTML spec restricts aria-label on <label> elements that are ancestors of labelable elements. A "labelable element" is any element that can be associated with a <label>, including <input> (except type="hidden"), <select>, <textarea>, <button>, <meter>, <output>, and <progress>.
If the <label> needs visible text, just use the text content of the <label> directly. If you need to provide an accessible name that differs from the visible text, place aria-label on the form control itself instead of on the <label>.
Examples
Invalid: aria-label on a label that wraps an input
<label aria-label="Enter your email address">
<input type="email" name="email">
</label>
Fixed: move aria-label to the input
If the visible label text is sufficient, remove aria-label entirely:
<label>
<input type="email" name="email">
</label>
If you need a more descriptive accessible name for the input, place aria-label on the input:
<label>
<input type="email" name="email" aria-label="Enter your email address">
</label>
The aria-label attribute is not allowed on a label element that is associated with a form control through the for attribute.
A <label> element already provides an accessible name for the form control it's associated with. Adding aria-label to the <label> itself creates a conflict: the aria-label would attempt to override the label's own accessible name, but the label's visible text is what gets passed to the associated form control. This redundancy is not only unnecessary but explicitly prohibited by the HTML specification.
The <label> element's purpose is to be the accessible label for another element. If you want the form control to have an accessible name, simply put that text inside the <label> element as visible content. If you need to provide a different accessible name directly to the form control, place the aria-label on the input element instead.
Incorrect Example
<label for="input_email" id="label_input_email" aria-label="Email">
</label>
<input type="email" id="input_email">
Correct Example
The simplest fix is to remove the aria-label from the <label>, since the label's text content already serves as the accessible name for the input:
<label for="input_email" id="label_input_email">
</label>
<input type="email" id="input_email">
If you need the accessible name to differ from the visible label text, place aria-label on the input instead:
<label for="input_email" id="label_input_email">
</label>
<input type="email" id="input_email" aria-label="Your email address">
A div element without an explicit role (or with role="generic") cannot have the aria-labelledby attribute because generic containers have no semantic meaning that benefits from a label.
The div element maps to the generic ARIA role by default. Generic elements are purely structural — they don't represent anything meaningful to assistive technologies. Labeling something that has no semantic purpose creates a confusing experience for screen reader users, since the label points to an element that doesn't convey a clear role.
The aria-labelledby attribute is designed for interactive or landmark elements — things like dialog, region, navigation, form, or group — where a label helps users understand the purpose of that section.
To fix this, you have two options: assign a meaningful ARIA role to the div, or use a more semantic HTML element that naturally supports labeling.
HTML Examples
❌ Invalid: aria-labelledby on a plain div
<h2 id="section-title">User Settings</h2>
<div aria-labelledby="section-title">
<p>Manage your account preferences here.</p>
</div>
✅ Fixed: Add a meaningful role to the div
<h2 id="section-title">User Settings</h2>
<div role="region" aria-labelledby="section-title">
<p>Manage your account preferences here.</p>
</div>
✅ Fixed: Use a semantic element instead
<h2 id="section-title">User Settings</h2>
<section aria-labelledby="section-title">
<p>Manage your account preferences here.</p>
</section>
Using a section element or adding role="region" tells assistive technologies that this is a distinct, meaningful area of the page — making the label useful and the markup valid.
A span element has an implicit ARIA role of generic, and the aria-labelledby attribute is not allowed on elements with that role.
The span element is a generic inline container with no semantic meaning. Its default ARIA role is generic, and the ARIA specification explicitly prohibits naming generic elements with aria-labelledby (or aria-label). This restriction exists because accessible names on generic containers create confusing experiences for assistive technology users — screen readers wouldn't know what kind of thing is being labeled.
To fix this, you have two main options:
- Add a meaningful
roleto thespanthat supportsaria-labelledby, such asrole="group",role="region", or any other role that accepts a label. - Use a more semantic element that already has an appropriate role, like a
section,nav, ordivwith an explicit role.
If the span doesn't truly need a label, simply remove the aria-labelledby attribute.
HTML Examples
❌ Invalid: aria-labelledby on a plain span
<span id="label">Settings</span>
<span aria-labelledby="label">
<input type="checkbox" id="opt1">
<label for="opt1">Enable notifications</label>
</span>
✅ Fix: Add an appropriate role
<span id="label">Settings</span>
<span role="group" aria-labelledby="label">
<input type="checkbox" id="opt1">
<label for="opt1">Enable notifications</label>
</span>
✅ Fix: Use a semantic element instead
<span id="label">Settings</span>
<fieldset aria-labelledby="label">
<input type="checkbox" id="opt1">
<label for="opt1">Enable notifications</label>
</fieldset>
The aria-labelledby attribute is not allowed on a <label> element when that <label> contains a labelable element (such as <input>, <select>, <textarea>, or <button>).
A <label> that wraps a form control gives that control its accessible name from the label's text. aria-labelledby also sets an accessible name, by pointing at other elements through their id. Putting it on the <label> names the label itself, not the control, and browsers differ on whether that referenced text replaces the label's own text when they compute the control's name. A screen reader user may hear the visible label, the referenced text, or a mix of both.
The spec avoids that ambiguity by rejecting aria-labelledby on a <label> that is an ancestor of a labelable element. A "labelable element" is any element a <label> can be associated with: <input> (except type="hidden"), <select>, <textarea>, <button>, <meter>, <output>, and <progress>.
If the label's visible text is enough, remove aria-labelledby. If the control needs a name built from other text on the page, put aria-labelledby on the control instead. On the control it overrides the <label>, so include the label's own id in the list to keep the visible text in the name.
Examples
Invalid: aria-labelledby on a label that wraps an input
<h2 id="shipping-heading">Shipping address</h2>
<label aria-labelledby="shipping-heading">
Postcode
<input type="text" name="postcode">
</label>
Fixed: remove the attribute
<h2 id="shipping-heading">Shipping address</h2>
<label>
Postcode
<input type="text" name="postcode">
</label>
Fixed: move it to the input
<h2 id="shipping-heading">Shipping address</h2>
<label id="postcode-label" for="postcode">Postcode</label>
<input type="text" id="postcode" name="postcode" aria-labelledby="shipping-heading postcode-label">
The aria-labelledby attribute creates a relationship between an element and the text content that labels it. It works by pointing to the id of one or more elements whose text should be used as the accessible name. When the validator reports that aria-labelledby must point to an element in the same document, it means at least one of the id values you referenced doesn't correspond to any element on the page.
This typically happens for a few reasons:
- Typo in the
id— thearia-labelledbyvalue doesn't exactly match the target element'sid(remember, IDs are case-sensitive). - The referenced element was removed — the labeling element existed at some point but was deleted or moved, and the reference wasn't updated.
- The
idexists in a different document —aria-labelledbycannot reference elements across pages, iframes, or shadow DOM boundaries. The target must be in the same document. - Dynamic content not yet rendered — the element is inserted by JavaScript after the validator parses the static HTML.
This is primarily an accessibility problem. Screen readers and other assistive technologies rely on aria-labelledby to announce meaningful labels to users. When the reference is broken, the element effectively has no accessible name, which can make it impossible for users to understand its purpose. Browsers won't throw a visible error, so the issue can go unnoticed without validation or accessibility testing.
To fix the issue, verify that every id referenced in aria-labelledby exists in the same HTML document. Double-check spelling and casing. If you reference multiple IDs (space-separated), each one must resolve to an existing element.
Examples
Incorrect — referencing a non-existent id
The aria-labelledby attribute points to "dialog-title", but no element with that id exists:
<div role="dialog" aria-labelledby="dialog-title">
<h2 id="dlg-title">Confirm deletion</h2>
<p>Are you sure you want to delete this item?</p>
</div>
Correct — matching id values
Ensure the id in the referenced element matches exactly:
<div role="dialog" aria-labelledby="dialog-title">
<h2 id="dialog-title">Confirm deletion</h2>
<p>Are you sure you want to delete this item?</p>
</div>
Incorrect — referencing multiple IDs where one is missing
When using multiple IDs, every one must be present. Here, "note-desc" doesn't exist:
<section aria-labelledby="note-heading note-desc">
<h3 id="note-heading">Important note</h3>
<p id="note-description">Please read carefully before proceeding.</p>
</section>
Correct — all referenced IDs exist
<section aria-labelledby="note-heading note-description">
<h3 id="note-heading">Important note</h3>
<p id="note-description">Please read carefully before proceeding.</p>
</section>
Incorrect — case mismatch
IDs are case-sensitive. "Main-Title" and "main-title" are not the same:
<nav aria-labelledby="Main-Title">
<h2 id="main-title">Site navigation</h2>
<ul>
<li><a href="/">Home</a></li>
</ul>
</nav>
Correct — consistent casing
<nav aria-labelledby="main-title">
<h2 id="main-title">Site navigation</h2>
<ul>
<li><a href="/">Home</a></li>
</ul>
</nav>
If you don't have a visible labeling element on the page and don't want to add one, consider using aria-label instead, which accepts a string value directly rather than referencing another element:
<nav aria-label="Site navigation">
<ul>
<li><a href="/">Home</a></li>
</ul>
</nav>
The aria-owns attribute is used to define parent-child relationships in the accessibility tree that aren't reflected in the DOM structure. For example, if a menu visually "owns" items that are placed elsewhere in the markup (perhaps for layout reasons), aria-owns tells assistive technologies that those elements should be treated as children of the owning element. The attribute accepts a space-separated list of one or more IDs.
According to the WAI-ARIA specification, each ID referenced by aria-owns must correspond to an element in the same document. If no matching element is found, the relationship is broken and the accessibility tree becomes inaccurate. This can confuse screen readers and other assistive technologies, potentially making parts of your page inaccessible or misrepresented to users who rely on them.
Common causes of this error:
- Typos in the ID value — a small misspelling like
aria-owns="drpdown-menu"instead ofaria-owns="dropdown-menu". - Referencing an element that doesn't exist — the target element was removed or never added to the page.
- Referencing an element in a different document — the target lives inside an
<iframe>or a shadow DOM, which are separate document contexts. - Dynamic content timing — the referenced element is added to the DOM by JavaScript after validation or after the
aria-ownsrelationship is evaluated.
How to fix it:
- Check that every ID in the
aria-ownsvalue exactly matches anidattribute on an element in the same document. - Look for typos or case mismatches — IDs are case-sensitive.
- If the target element is inside an
<iframe>, restructure your markup so both elements are in the same document, or use a different ARIA approach. - If the element is added dynamically, ensure it exists in the DOM before the
aria-ownsrelationship is needed by assistive technologies.
Examples
Incorrect — referencing a nonexistent ID
The element with id="dropdown-items" does not exist anywhere in the document, so the aria-owns reference is broken.
<button aria-owns="dropdown-items">Open Menu</button>
<!-- No element with id="dropdown-items" exists -->
Incorrect — typo in the referenced ID
The button references "menu-lst" but the actual element has id="menu-list".
<button aria-owns="menu-lst">Options</button>
<ul id="menu-list">
<li>Option A</li>
<li>Option B</li>
</ul>
Correct — referenced ID exists in the same document
The aria-owns value matches the id of an element present in the same page.
<button aria-owns="menu-list">Options</button>
<ul id="menu-list">
<li>Option A</li>
<li>Option B</li>
</ul>
Correct — multiple IDs referenced
When aria-owns lists multiple IDs, each one must have a corresponding element in the document.
<div role="tree" aria-owns="branch1 branch2 branch3">
File Explorer
</div>
<div role="treeitem" id="branch1">Documents</div>
<div role="treeitem" id="branch2">Pictures</div>
<div role="treeitem" id="branch3">Music</div>
Complete valid example
<!DOCTYPE html>
<html lang="en">
<head>
<title>aria-owns Example</title>
</head>
<body>
<div role="combobox" aria-expanded="true" aria-owns="suggestions">
<input type="text" aria-autocomplete="list">
</div>
<ul id="suggestions" role="listbox">
<li role="option">Apple</li>
<li role="option">Banana</li>
<li role="option">Cherry</li>
</ul>
</body>
</html>
In this example, the combobox uses aria-owns to claim the suggestions listbox as its child in the accessibility tree, even though the <ul> is a sibling in the DOM. Because the id="suggestions" element exists in the same document, the reference is valid and assistive technologies can correctly associate the two.
Every HTML semantic element carries an implicit ARIA role that assistive technologies already recognize. The <article> element has a built-in role of article, which signals that the content represents a self-contained composition — such as a blog post, news story, forum comment, or any section that could be independently distributed or reused. When you explicitly add role="article" to an <article> element, you're telling the browser and screen readers something they already know.
While this redundancy won't break anything functionally, it creates unnecessary noise in your markup and goes against the W3C's guidance on using ARIA. The first rule of ARIA use states: "If you can use a native HTML element or attribute with the semantics and behavior you require already built in, instead of repurposing an element and adding an ARIA role, state or property to make it accessible, then do so." Redundant roles make code harder to maintain and can signal to other developers that something non-standard is happening when it isn't.
The role="article" attribute is useful when applied to non-semantic elements like <div> or <span> that need to convey article semantics — for instance, in legacy codebases where changing the element isn't feasible. But on the <article> element itself, it should simply be removed.
Examples
❌ Redundant role on <article>
This triggers the validator warning because role="article" duplicates the element's implicit role:
<article role="article">
<h2>Breaking News</h2>
<p>A rare bird was spotted in the city park this morning.</p>
</article>
✅ Fixed: no explicit role needed
Simply remove the role attribute. The <article> element already communicates the article role to assistive technologies:
<article>
<h2>Breaking News</h2>
<p>A rare bird was spotted in the city park this morning.</p>
</article>
✅ Appropriate use of role="article" on a non-semantic element
If you cannot use the <article> element for some reason, applying the role to a generic element like <div> is valid and useful:
<div role="article">
<h2>Breaking News</h2>
<p>A rare bird was spotted in the city park this morning.</p>
</div>
✅ Multiple articles within a feed
A common pattern is nesting several <article> elements inside a feed. No explicit roles are needed on the articles themselves:
<section role="feed" aria-label="Latest posts">
<article>
<h2>First Post</h2>
<p>Content of the first post.</p>
</article>
<article>
<h2>Second Post</h2>
<p>Content of the second post.</p>
</article>
</section>
This same principle applies to other semantic elements with implicit roles — for example, <nav> already has role="navigation", <main> has role="main", and <header> has role="banner". Avoid adding redundant roles to any of these elements to keep your HTML clean and standards-compliant.
The HTML specification defines built-in semantic roles for many elements, and the <header> element is one of them. When a <header> is a direct child of <body> (or at least not nested inside a sectioning element), browsers and assistive technologies already interpret it as a banner landmark — the region of the page that typically contains the site logo, navigation, and other introductory content. Explicitly adding role="banner" duplicates what the browser already knows, which adds unnecessary noise to your markup.
This principle is part of the WAI-ARIA specification's guidance on using ARIA roles: the first rule of ARIA is "If you can use a native HTML element or attribute with the semantics and behavior you require already built in, instead of re-purposing an element and adding an ARIA role, state, or property to make it accessible, then do so." Redundant roles don't typically break anything, but they clutter the code, can confuse developers maintaining the project, and signal a misunderstanding of HTML semantics.
It's worth noting an important nuance: the <header> element only maps to the banner role when it is not a descendant of <article>, <aside>, <main>, <nav>, or <section>. When nested inside one of these sectioning elements, <header> has no corresponding landmark role — it simply serves as the header for that particular section. In that context, adding role="banner" would not be redundant; it would actually change the semantics, which is almost certainly not what you want.
To fix the warning, remove the role="banner" attribute from your <header> element. The native semantics are sufficient.
Examples
Incorrect: redundant role="banner" on <header>
This triggers the validator warning because <header> already implies the banner role at the top level:
<header role="banner">
<img src="logo.svg" alt="My Company">
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
</nav>
</header>
Correct: let <header> use its implicit role
Simply remove the role="banner" attribute:
<header>
<img src="logo.svg" alt="My Company">
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
</nav>
</header>
Correct: using role="banner" on a non-<header> element
If for some reason you cannot use a <header> element (e.g., working within a legacy CMS), applying role="banner" to a <div> is the appropriate way to convey the same landmark semantics:
<div role="banner">
<img src="logo.svg" alt="My Company">
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
</nav>
</div>
A <header> inside a sectioning element has no banner role
When <header> is nested inside an <article> or other sectioning element, it does not carry the banner role. This is expected and correct — the <header> here simply introduces the article content:
<article>
<header>
<h2>Article Title</h2>
<p>Published on <time datetime="2024-01-15">January 15, 2024</time></p>
</header>
<p>Article content goes here.</p>
</article>
The <base> element must appear before any <link> or <script> elements in the <head> section of the document.
The <base> element sets the base URL and/or default target for all relative URLs in a page. Because <link> and <script> elements often reference external resources using relative URLs, the browser needs to know the base URL before it encounters those elements. If <base> appears after a <link> or <script>, the browser may have already resolved their URLs without the intended base, leading to broken references or unexpected behavior.
Only one <base> element is allowed per document, and the HTML specification requires it to appear before any elements that have attributes accepting URLs. In practice, placing it as the first child of <head> (after <meta charset>) is the simplest way to satisfy this rule.
Invalid example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example</title>
<link rel="stylesheet" href="styles/main.css">
<script src="js/app.js"></script>
<base href="https://example.com/">
</head>
<body>
<p>Hello</p>
</body>
</html>
The <base> element comes after the <link> and <script> elements, which triggers the validation error.
Valid example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<base href="https://example.com/">
<title>Example</title>
<link rel="stylesheet" href="styles/main.css">
<script src="js/app.js"></script>
</head>
<body>
<p>Hello</p>
</body>
</html>
Moving <base> before the <link> and <script> elements fixes the error and ensures all relative URLs resolve correctly.
The <big> element was a purely presentational HTML element that increased the text size by one level (similar to moving from small to medium, or medium to large). HTML5 removed it from the specification because it violates the principle of separating content structure from visual presentation. HTML should describe the meaning of content, while CSS should handle how it looks.
Using obsolete elements causes several problems. First, W3C validation will fail, which can impact code quality standards and SEO audits. Second, while current browsers still support <big> for backward compatibility, there's no guarantee future browsers will continue to do so. Third, the <big> element carries no semantic meaning — it doesn't tell assistive technologies why the text is larger, only that it should be displayed differently. CSS gives you more precise control over font sizing while keeping your HTML clean and standards-compliant.
To fix this issue, replace every <big> element with a <span> (or another semantically appropriate element) and apply CSS to control the font size. You can use inline styles, a <style> block, or an external stylesheet.
If the larger text has a specific meaning — such as emphasizing importance — consider using a semantic element like <strong> or <em> instead, and style it with CSS as needed.
Examples
❌ Obsolete: using the <big> element
<p>This is <big>important text</big> in a paragraph.</p>
✅ Fixed: using a <span> with inline CSS
This is a direct replacement that mimics the original behavior of <big>, which rendered text at font-size: larger:
<p>This is <span style="font-size: larger;">important text</span> in a paragraph.</p>
✅ Fixed: using a CSS class
For better maintainability, use a class instead of inline styles:
<style>
.text-big {
font-size: larger;
}
</style>
<p>This is <span class="text-big">important text</span> in a paragraph.</p>
✅ Fixed: using a semantic element with CSS
If the text is larger because it's important or emphasized, use a semantic element and style it:
<style>
.highlight {
font-size: 1.25em;
}
</style>
<p>This is <strong class="highlight">important text</strong> in a paragraph.</p>
Choosing a font-size value
The <big> element historically corresponded to font-size: larger, but with CSS you have full flexibility:
font-size: larger— relative increase, closest to original<big>behaviorfont-size: 1.2em— scales to 120% of the parent's font sizefont-size: 1.25rem— scales relative to the root font sizefont-size: 20px— absolute pixel value (less flexible, generally avoid)
Using relative units like em, rem, or the larger keyword is preferred because they scale well across different screen sizes and respect user font-size preferences.
In earlier versions of HTML, the border attribute on <img> was commonly used to control the border width in pixels. Its most frequent use was border="0" to suppress the default blue border browsers would render around images wrapped in <a> links. While this worked, it mixed presentation with markup — something HTML5 discourages in favor of a clean separation between structure (HTML) and styling (CSS).
The W3C HTML Validator flags this attribute as obsolete because it was removed from the HTML5 specification. Modern browsers still understand it for backward compatibility, but relying on deprecated features is bad practice. It can lead to inconsistencies across browsers, makes your code harder to maintain, and signals to validators and other developers that the markup is outdated.
The recommended approach is to handle image borders entirely in CSS. If you previously used border="0" to remove borders from linked images, most modern CSS resets and normalize stylesheets already handle this. If you're not using a reset, a single CSS rule takes care of it globally — no need to repeat the attribute on every <img> tag.
How to fix it
- Remove the
borderattribute from all<img>elements. - Add a CSS rule to achieve the same effect. For removing borders, use
img { border: 0; }in your stylesheet. For adding a visible border, use properties likeborder: 2px solid #333;.
Examples
❌ Obsolete border attribute
<a href="/products">
<img src="product.jpg" alt="Our product" border="0">
</a>
This triggers the validator warning because border is no longer a valid attribute on <img>.
✅ Fixed with CSS (external/internal stylesheet)
<style>
img {
border: 0;
}
</style>
<a href="/products">
<img src="product.jpg" alt="Our product">
</a>
A single rule in your stylesheet removes borders from all images, which is cleaner and easier to maintain than repeating the attribute on every element.
✅ Fixed with inline CSS (if needed)
<a href="/products">
<img src="product.jpg" alt="Our product" style="border: 0;">
</a>
Inline styles work but aren't ideal for large-scale fixes. Prefer a stylesheet rule when possible.
✅ Adding a decorative border with CSS
If your intent was to add a visible border (e.g., border="2"), replace it with a more flexible CSS equivalent:
<style>
.bordered {
border: 2px solid #333;
}
</style>
<img src="photo.jpg" alt="A scenic landscape" class="bordered">
CSS gives you far more control — you can specify the border style, color, individual sides, and even use border-radius for rounded corners, none of which were possible with the old border attribute.
The border attribute on the <img> element is obsolete in HTML5 and should be replaced with CSS.
Older versions of HTML allowed border as an attribute directly on <img> elements, most commonly set to 0 to remove the blue border that browsers added around images wrapped in links. HTML5 dropped this attribute from the specification. Modern browsers no longer add that default border, so in most cases the attribute can simply be removed.
If you still need to control the border on an image, use CSS instead. You can apply a style directly with the style attribute, use a class, or add a rule in your stylesheet.
HTML examples
Invalid: using the obsolete border attribute
<a href="/home">
<img src="logo.png" alt="Logo" border="0">
</a>
Valid: using CSS instead
<a href="/home">
<img src="logo.png" alt="Logo" style="border: 0;">
</a>
Or, with a stylesheet rule:
<style>
img {
border: 0;
}
</style>
<a href="/home">
<img src="logo.png" alt="Logo">
</a>
The border attribute is obsolete on the <input> element, and a border on an image button belongs in CSS.
Old markup often puts border="0" on <input type="image">, the image button, a habit copied from linked images. The HTML standard lists border on input as an obsolete attribute, and the validator warns about it on every input type, submit and text included.
Browsers still apply the attribute in one case. On an image button, a value above zero draws a solid border that many pixels wide. A value of 0 changes nothing, and browsers ignore the attribute on every other input type. On most pages you can delete it and nothing on screen changes.
The message suggests img { border: 0; }, but that rule styles <img> elements, not inputs. If the attribute had a value above zero and you want to keep the border, write a CSS rule for the image button itself.
Invalid example
<form action="/search">
<input type="search" name="q" aria-label="Search">
<input type="image" src="search.png" alt="Search" border="0">
</form>
Valid example
<form action="/search">
<input type="search" name="q" aria-label="Search">
<input type="image" src="search.png" alt="Search">
</form>
If the old value was border="2", this rule in your stylesheet draws the same border:
input[type="image"] {
border: 2px solid;
}
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.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries