Skip to main content

Top 10 HTML Errors

Web developers worldwide have found 424 million HTML issues on 12 million checked web pages.
Here are the most common issues detected by Rocket Validator.

Last update: Thursday, February 26, 2026

1. Element “X” not allowed as child of element “Y” in this context. 33.31%

The W3C HTML Validator raises this error when an element is placed inside a parent element that doesn’t allow it according to the HTML specification. Each HTML element has a defined content model that specifies which child elements are permitted. To fix this, restructure your markup so that child elements match what the parent element expects.

2. Duplicate ID “X”. 23.65%

The id attribute must be unique within an HTML document — no two elements can share the same id value. When the W3C validator reports “Duplicate ID,” it means the same id has been assigned to more than one element. To fix this, ensure every id in your document is distinct, or switch to class when you need to apply the same identifier to multiple elements.

3. Attribute “X” not allowed on element “Y” at this point. 16.78%

The W3C HTML Validator reports this error when an attribute is used on an HTML element that doesn’t support it according to the HTML specification. This can happen because the attribute is misspelled, belongs to a different element, is an obsolete attribute, or is a custom attribute that isn’t using the data-* prefix. To fix it, remove the invalid attribute, correct any typos, move it to an appropriate element, or convert custom attributes to the data-* format.

4. No space between attributes. 7.12%

HTML attributes must be separated by at least one whitespace character (space, tab, or newline). When attributes are placed directly next to each other without a space between them, the W3C HTML Validator will report an error. The fix is straightforward: ensure there is a space between each attribute in every HTML element.

5. An element with the attribute “tabindex” must not appear as a descendant of the “a” element. 5.42%

An element with a tabindex attribute must not appear as a descendant of an <a> (anchor) element. This creates conflicting focus targets within an interactive element, confusing keyboard navigation and assistive technologies. To fix this, remove the tabindex attribute from any descendant elements inside the <a> element, or restructure your markup so that interactive or focusable elements are not nested inside links.

6. An “img” element must have an “alt” attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images. 4.31%

Every <img> element must include an alt attribute that provides a text alternative for the image. This attribute is critical for accessibility—screen readers rely on it to describe images to users who cannot see them—and it also serves as fallback text when the image fails to load. To fix this issue, add an alt attribute to every <img> tag, setting it to a meaningful description or to an empty string (alt="") for purely decorative images.

7. Bad value “” for attribute “target” on element “a”: Browsing context name must be at least one character long. 2.84%

The target attribute on an <a> element cannot be an empty string. When target is present, it must contain at least one character — either a valid browsing context keyword (like _blank, _self, _parent, or _top) or a custom name for a browsing context. To fix this, either remove the target attribute entirely or provide a valid value.

8. Element X is missing one or more of the following attributes: “role”. 2.27%

When an element uses ARIA states or properties (like aria-expanded, aria-label, or aria-hidden) without having a defined role, the validator reports that the element is missing a required role attribute. To fix this, either add an explicit role attribute to the element or use a semantic HTML element that already carries an implicit ARIA role matching the states and properties you’re applying.

9. Stray end tag “X”. 2.17%

A “Stray end tag” error occurs when the HTML parser encounters a closing tag (</X>) that doesn’t match any currently open element. This typically happens due to duplicate closing tags, mismatched nesting, or closing tags left behind after editing. The fix is to locate and remove the orphaned end tag or correct the document structure so every closing tag has a corresponding opening tag.

10. Bad value “rocketlazyloadscript” for attribute “type” on element “script”: Subtype missing. 2.13%

The type attribute on a <script> element requires a valid MIME type, but the value rocketlazyloadscript is not a recognized MIME type and is missing the required subtype component (e.g., text/javascript). This non-standard value is injected by the WP Rocket WordPress plugin to implement lazy loading of scripts. To fix this, you can either configure WP Rocket to exclude specific scripts from its lazy loading behavior, or accept these validation errors as a trade-off of using the plugin’s performance optimization.

Switch to Spanish or Portuguese

Ready to validate your sites?
Start your trial today.