HTML Guide
The maxlength attribute can be used on an input element to define a client-side validation for the maximum length allowed on an input without resorting to JavaScript.
This attribute is only allowed on elements of type email, password, search, tel, text, or url.
The minlength attribute can be used on an input element to define a client-side validation for the maximum length allowed on an input without resorting to JavaScript.
This attribute is only allowed on elements of type email, password, search, tel, text, or url.
The minlength attribute defines the minimum number of characters (as UTF-16 code units) the user can enter into an <input> or <textarea>. This must be an integer value 0 or higher. If no minlength is specified, or an invalid value is specified, the input has no minimum length. This value must be less than or equal to the value of maxlength, otherwise the value will never be valid, as it is impossible to meet both criteria.
Here’s an example:
<label for="name">Enter your name (max 25 characters)</label>
<input type="text" minlength="25" id="name">
A <meta> tag has been found that is either malformed, or in a bad place within the document. Check its attributes and context.
For example, the following HTML contains a valid <meta> tag that is raising an issue because of bad context, caused by an <img> tag that shouldn’t be there:
<!DOCTYPE html>
<html lang="">
<head>
<title>Test</title>
<img src="photo.jpg" alt="A smiling cat" />
<meta name="description" content="Description of this page" />
</head>
<body>
<p>Some content</p>
</body>
</html>
If we fix that document and move the <img> tag within the body, the issue raised about <meta> disappears because it’s now in a valid context:
<!DOCTYPE html>
<html lang="">
<head>
<title>Test</title>
<meta name="description" content="Description of this page" />
</head>
<body>
<p>Some content</p>
<img src="photo.jpg" alt="A smiling cat" />
</body>
</html>
Check the syntax of the affected tag, it’s probably malformed and a < character inside has been interpreted as an attribute.
For example, this code might cause this issue:
<!-- Malformed img tag -->
<img src="photo.jpg" alt="smiling cat" < />
<!-- Fixed img tag -->
<img src="photo.jpg" alt="smiling cat" />
The ontouchstart attribute, used in devices with a touch screen, and not supported by all browsers, is not a valid attribute in the current HTML5 standard.
You can consider replacing it with the more generic onclick attribute, or still use it if you’re OK with its limitations.
The pattern attribute is only allowed on input whose type is email, password, search, tel, text or url. Check the type used, and consider changing to one of the allowed types to enable pattern client-side validation.
The pattern attribute is a handy way of adding client-side validation on HTML forms without resorting to JavaScript. Check out this article to learn more about Input Pattern.
The placeholder attribute is used on <input> elements as text that appears in the form control when it has no value set. Only inputs of type email, number, password, search, tel, text, or url accept this attribute.
For example, an input of type hidden doesn’t accept a placeholder attribute as it makes no sense to specify text to appear when the input is empty, if that input is hidden.
Remove the readonly attribute from unsupported input types or change the input’s type to one that allows readonly.
The readonly attribute is only valid for textual input controls where the user can select text but not modify it. Per the HTML standard and W3C validators, allowed types are: text, search, url, tel, email, password, date, month, week, time, datetime-local, and number. It is not permitted on types like checkbox, radio, range, color, file, button, submit, reset, image, or hidden. For non-textual inputs, use disabled to prevent interaction, or use scripting/ARIA patterns as appropriate. Remember that disabled fields are excluded from form submission, while readonly fields are submitted.
HTML Examples
Example that triggers the validator error
<input type="checkbox" name="agree" readonly>
Corrected examples
<!-- Use a supported type with readonly -->
<input type="text" name="code" value="ABC-123" readonly>
<!-- For non-text controls, use disabled if you need it non-interactive -->
<input type="checkbox" name="agree" disabled>
The boolean required attribute can only be used with certain types of inputs. Check the input type is one of the allowed.
The required attribute, if present, indicates that the user must specify a value for the input before the owning form can be submitted.
The seamless attribute was proposed to be included in the HTML5 spec, but it wasn’t finally accepted, so it’s not a valid attribute for <iframe>.
The attribute st_title is not allowed on <span> elements.
This issue is commonly caused by an old integration of ShareThis via Drupal or other CMS - the old code used invalid attributes like displayText, st_url and st_title which were later changed to HTML5 custom data attributes.
The attribute st_url is not allowed on <span> elements.
This issue is commonly caused by an old integration of ShareThis via Drupal or other CMS - the old code used invalid attributes like displayText, st_url and st_title which were later changed to HTML5 custom data attributes.
The <textarea> element does not have a type attribute.
The HTML <textarea> element represents a multi-line plain-text editing control, and is useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form.
There is no attribute validate on the <form> element. Perhaps you meant novalidate?
If the novalidate attribute is present on a <form>, indicates that the form is not to be validated during submission.
For example, while this form has a required attribute on its input, it won’t be enforced because form validation has been disabled using novalidate:
<form novalidate>
<label>City: <input required name="city"></label>
<input type="submit" />
</form>
An attribute has been found in an element, where the intended value is missing. A common cause is including the equal sign, but not passing anything after it.
For example:
<!-- This is missing the value for the style attribute, so it's invalid -->
<p style=></p>
<!-- This is explicitly passing a blank string as the value, so it's valid -->
<p style=""></p>
Using the xmlns:dt attribute in the <html> tag is invalid in HTML5 and triggers validation errors because custom XML namespaces are not supported in HTML.
HTML5 does not support arbitrary XML namespaces, as used in XHTML or other XML-based vocabularies. The attribute xmlns:dt is specific to XML serialization and not serializable as per XML 1.0 rules when used in HTML5 documents, which no longer use the XML namespace mechanism. The only allowed use of xmlns in HTML is for SVG and MathML in embedded contexts, under specific interoperability rules.
To resolve this, remove the xmlns:dt attribute entirely from your document and use a standard HTML <html> declaration.
Incorrect (causes validation error):
<html xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
</html>
Correct (W3C-compliant HTML5):
<!DOCTYPE html>
<html lang="en">
<head>
<title>No XMLNS Namespace</title>
</head>
<body>
<!-- Your content here -->
</body>
</html>
Remove XML-specific attributes from HTML documents to ensure compatibility and compliance with modern HTML standards.
Both xmlns:fb and xmlns:og attributes have been deprecated. If you’re using Facebook / Open Graph Protocol proprietary tags in you document, you can update the markup to the new syntax.
The xmlns:m attribute is an XML namespace declaration and not valid on the html element in HTML documents.
HTML5 does not support custom XML namespaces; they are only used in XML-based languages such as XHTML. The global xmlns:* attributes like xmlns:m are not allowed on the <html> element in HTML documents that use the text/html MIME type. This causes serialization and validation errors, especially with W3C HTML validation.
To fix this, remove the xmlns:m attribute from the <html> tag. If you need to use a namespace, your document should be XHTML and served as application/xhtml+xml, not as regular HTML.
Incorrect HTML (causes validation error):
<html xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
<head>
<title>Invalid Namespace Example</title>
</head>
<body>
<!-- Content -->
</body>
</html>
Correct HTML (remove the namespace declaration):
<!DOCTYPE html>
<html lang="en">
<head>
<title>Valid HTML Example</title>
</head>
<body>
<!-- Content -->
</body>
</html>
If you require usage of MathML, SVG, or other XML vocabularies, HTML5 already supports them natively without explicit namespace declarations. For Microsoft Office Markup Language (OMML), use proper XML/XHTML serialization and the correct MIME type if absolutely necessary. For typical web content, avoid custom XML namespaces in HTML5.
Remove the xmlns:o attribute from your HTML elements.
When working with HTML documents intended for the web, often using namespaces like in XML documents may result in validation issues under specific standards like the W3C HTML validator. The xmlns:o attribute is typically associated with XML or XHTML documents and may not align with HTML5’s requirements, causing serialization issues in environments expecting XML 1.0 compliance. These attributes are often seen in documents meant to incorporate Microsoft Office-specific XML schemas—information that HTML5 doesn’t require or recognize.
For HTML5 documents, consider restructuring the content to avoid unnecessary XML namespace attributes. HTML5 has evolved away from strict reliance on XML, focusing instead on a more simplified model.
Example:
Before:
<!DOCTYPE html>
<html xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<title>Page Title</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
After:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
By removing the xmlns:o attribute, the document aligns with HTML5 standards without the unnecessary constraints of XML namespaces.
The attribute xmlns:serif is not valid. Check this guide for more information on this issue.
Remove the xmlns:svg attribute from the <svg> element, leaving only the valid xmlns attribute.
The xmlns attribute defines the XML namespace for the SVG and is correctly set to http://www.w3.org/2000/svg. The xmlns:svg attribute attempts to declare a prefixed namespace, which is unnecessary and invalid in both HTML and SVG served as XML (or embedded in HTML). The W3C validator flags this because HTML5 does not allow arbitrary XML namespace declarations beyond the standard SVG namespace; such prefixes are not used in HTML serialization.
Incorrect usage:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<!-- SVG content -->
</svg>
Correct usage:
<svg xmlns="http://www.w3.org/2000/svg">
<!-- SVG content -->
</svg>
Only xmlns="http://www.w3.org/2000/svg" is required for inline SVG in HTML.
The xmlns:v attribute is not valid in HTML5 and should be removed to ensure compliance with W3C standards.
The xmlns:v namespace attribute was historically used for VML (Vector Markup Language), mainly in legacy support for Internet Explorer. Modern HTML, particularly the living standard and HTML5, does not permit namespace declarations using xmlns attributes like xmlns:v. These are only valid in XML-based serializations, such as XHTML. Including xmlns:v in a standard HTML5 document results in validation errors because HTML does not support custom namespaces.
Incorrect HTML:
<!DOCTYPE html>
<html xmlns:v="urn:schemas-microsoft-com:vml" lang="en">
<head>
<title>VML Namespace Example</title>
</head>
<body>
<!-- Content -->
</body>
</html>
Corrected HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<title>VML Namespace Removed</title>
</head>
<body>
<!-- Content -->
</body>
</html>
Remove the xmlns:v attribute entirely to resolve the validator warning and ensure your HTML meets current standards. If you are not using VML, no further changes are necessary. If you require vector graphics, use SVG instead, which is fully supported in HTML5.
Using the attribute xmlns:w="urn:schemas-microsoft-com:office:word" in HTML is invalid because custom XML namespace declarations are not allowed in HTML5.
HTML5 does not support custom namespaces like xmlns:w, which are used in XML-based formats such as XHTML or Office documents, but not in regular HTML. The HTML parser ignores unknown attributes and does not treat them as namespaces, which can result in validation errors. Only predefined namespaces allowed by the HTML specification (such as the default for SVG or MathML) are supported via the appropriate embedding elements.
Correct HTML Example Without Custom Namespace:
<!DOCTYPE html>
<html lang="en">
<head>
<title>No Custom Namespace Example</title>
</head>
<body>
<p>Custom XML namespaces like <code>xmlns:w</code> are not valid in HTML5.</p>
</body>
</html>
Incorrect Example That Causes the Error:
<html xmlns:w="urn:schemas-microsoft-com:office:word">
<!-- ... -->
</html>
To fix the error, remove the xmlns:w attribute from your HTML. If you need to use Office-specific features or XML namespaces, use an appropriate XML-based format (such as XHTML or OOXML), but not standard HTML5.
An attribute could not be parsed from the HTML input, probably due to a typo. Check this guide for a related HTML issue.
An invalid attribute has been found on an element. Check the affected tag to ensure attributes are well-formed, and if they are you can consider using custom data attributes.