Skip to main content

Top 10 HTML Errors in Portugal

These are the main HTML issues found in the most prominent Portugal websites.
The website list is curated by Ruben Ferreira Duarte, A11Y trainer and editor of the DXD blog

Last update: Monday, February 2, 2026

1. Duplicate ID “X”. 34.19%

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.

2. Attribute “X” not allowed on element “Y” at this point. 28.84%

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.

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

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.

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

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.

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

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.

6. Duplicate attribute “X”. 3.42%

Each HTML element must have unique attribute names — no attribute can appear more than once on the same element. When the W3C validator reports “Duplicate attribute,” it means an attribute like id, class, or any other has been specified two or more times on a single element. To fix this, merge the duplicate attributes into a single declaration or remove the unintended repetition.

7. Element “div” not allowed as child of element “ul” in this context. 2.39%

A <div> element has been placed as a direct child of a <ul> element, which violates the HTML specification. The <ul> element only permits <li>, <script>, and <template> elements as direct children. To fix this, either move the <div> inside an <li> element, or restructure your markup so the <ul> contains only valid children.

8. Bad value “tel: X” for attribute “href” on element “a”: Illegal character in scheme data. 2.08%

The href attribute on an <a> element contains an illegal character in the URI scheme data. This commonly occurs with tel: links when a space is placed after the colon, but it applies to any URI scheme (mailto:, tel:, http:, etc.) with invalid characters. Remove the space or illegal character immediately following the colon to fix the issue.

9. Stray end tag “X”. 1.49%

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 “X” for attribute “src” on element “img”: Illegal character in path segment: space is not allowed. 1.40%

Spaces in URLs used in HTML attributes like src are not valid according to the URL specification. When the W3C validator encounters a space in an img element’s src attribute, it reports an illegal character error. To fix this, replace each space with %20 (percent-encoding) or restructure the URL to avoid spaces entirely.

Switch to Spanish or Portuguese

Ready to validate your sites?
Start your trial today.