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.
In XML and XHTML, the xmlns attribute is used to declare namespaces that allow elements and attributes from different vocabularies to coexist without naming conflicts. The xmlns:o prefix specifically declares the Microsoft Office namespace (urn:schemas-microsoft-com:office:office), which enables Office-specific elements and attributes like <o:p> (Office paragraph markers) within the document.
HTML5, however, is not an XML language. The HTML5 specification only permits the xmlns attribute on the <html> element (and only with the value http://www.w3.org/1999/xhtml), along with xmlns:xlink on SVG elements. Custom namespace prefixes like xmlns:o, xmlns:v (VML), and xmlns:w (Word) are not recognized as valid attributes on any HTML5 element and will trigger validation errors.
Why This Happens
This issue most commonly occurs when:
- Content is pasted from Microsoft Word into a WYSIWYG editor or CMS. Word generates its own flavor of HTML that includes Office namespace declarations and proprietary elements.
- HTML files are exported from Office applications like Word, Excel, or Outlook. These exports produce markup heavily reliant on Office-specific namespaces.
- Email templates are built using tools that generate Office-compatible HTML, carrying namespace baggage into standard web pages.
Why It Matters
- Standards compliance: HTML5 does not support arbitrary XML namespace declarations, so these attributes make your document invalid.
- Bloated markup: Office-generated HTML often includes not just the namespace declarations but also large amounts of Office-specific elements, conditional comments, and inline styles that increase page size significantly.
- Maintenance difficulty: Office-flavored HTML is harder to read, edit, and maintain compared to clean, standards-compliant markup.
- Potential rendering issues: While browsers generally ignore unrecognized attributes, the accompanying Office-specific elements (like
<o:p>) can occasionally cause unexpected spacing or layout behavior.
How to Fix It
- Remove all
xmlns:oattributes from your HTML elements. - Remove any Office-specific elements such as
<o:p>,<o:SmartTagType>, or similar tags that rely on the Office namespace. - Check for other Office namespaces like
xmlns:v,xmlns:w,xmlns:m, andxmlns:st1— these should also be removed. - Clean pasted content before inserting it into your HTML. Many text editors and CMS platforms offer a "Paste as plain text" option that strips out Office formatting.
- If you use a CMS or rich text editor, look for a "Clean up Word HTML" or similar feature to automatically strip Office artifacts.
Examples
❌ Invalid: Office namespace declarations on elements
<!DOCTYPE html>
<html lang="en">
<head>
<title>Company Report</title>
</head>
<body xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w="urn:schemas-microsoft-com:office:word">
<h1>Quarterly Report</h1>
<p class="MsoNormal">Revenue increased by 15% this quarter.<o:p></o:p></p>
<p class="MsoNormal">Expenses remained stable.<o:p></o:p></p>
</body>
</html>
This markup contains three Office namespace declarations on the <body> element and uses <o:p> elements inside paragraphs — all of which are invalid in HTML5.
✅ Valid: Clean HTML without Office namespaces
<!DOCTYPE html>
<html lang="en">
<head>
<title>Company Report</title>
</head>
<body>
<h1>Quarterly Report</h1>
<p>Revenue increased by 15% this quarter.</p>
<p>Expenses remained stable.</p>
</body>
</html>
❌ Invalid: Namespace on a div element
<div xmlns:o="urn:schemas-microsoft-com:office:office">
<p class="MsoNormal">Meeting notes from Tuesday.<o:p></o:p></p>
</div>
✅ Valid: Clean version
<div>
<p>Meeting notes from Tuesday.</p>
</div>
Notice that in the corrected examples, the class="MsoNormal" attribute was also removed. While MsoNormal is technically a valid class name that won't cause a validation error, it's an Office-generated class with no purpose unless you have corresponding CSS rules — removing it keeps your markup clean.
If you genuinely need XML namespace support for document processing, use a proper XHTML document served with the application/xhtml+xml content type, or handle the XML processing separately from your web-facing HTML.
In older XHTML documents, XML namespaces were declared using the xmlns attribute with a prefix, such as xmlns:og="http://ogp.me/ns#". While this syntax was valid in XHTML, HTML5 does not support custom XML namespace declarations on the <html> element. The W3C validator will flag any xmlns:* prefixed attribute (like xmlns:og, xmlns:fb, etc.) as invalid because HTML5 has a strictly defined set of allowed attributes on the <html> element.
The Open Graph Protocol, originally developed by Facebook, allows web pages to become rich objects in a social graph. Major platforms like Facebook, Twitter, LinkedIn, and others rely on Open Graph <meta> tags to generate link previews. The official Open Graph Protocol specification recommends using the prefix attribute on the <html> element instead of the xmlns:og namespace declaration.
The prefix attribute is part of the RDFa specification and is recognized by HTML5 as a valid way to declare vocabulary prefixes. By switching to prefix="og: https://ogp.me/ns#", you maintain full Open Graph functionality while keeping your HTML valid.
How to fix it
- Locate the
<html>tag in your document. - Remove any
xmlns:og(or similarxmlns:*) attributes. - Add or update the
prefixattribute with the appropriate namespace declaration.
If you use multiple prefixes (e.g., Open Graph and Facebook-specific tags), you can combine them in a single prefix attribute, separated by a space.
Examples
❌ Invalid: Using xmlns:og (XHTML-style namespace)
<!DOCTYPE html>
<html lang="en" xmlns:og="http://ogp.me/ns#">
<head>
<title>My Page</title>
<meta property="og:title" content="My Page Title" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://example.com/" />
<meta property="og:image" content="https://example.com/image.jpg" />
</head>
<body>
<p>Page content here.</p>
</body>
</html>
This triggers the validator error: Attribute "xmlns:og" not allowed here.
✅ Valid: Using the prefix attribute
<!DOCTYPE html>
<html lang="en" prefix="og: https://ogp.me/ns#">
<head>
<title>My Page</title>
<meta property="og:title" content="My Page Title" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://example.com/" />
<meta property="og:image" content="https://example.com/image.jpg" />
</head>
<body>
<p>Page content here.</p>
</body>
</html>
✅ Valid: Multiple prefixes (Open Graph and Facebook)
If you also use Facebook-specific meta tags (like fb:app_id), declare both prefixes:
<!DOCTYPE html>
<html lang="en" prefix="og: https://ogp.me/ns# fb: https://ogp.me/ns/fb#">
<head>
<title>The Rock (1996)</title>
<meta property="fb:app_id" content="123456789" />
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="https://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="https://ia.media-imdb.com/images/rock.jpg" />
</head>
<body>
<p>Page content here.</p>
</body>
</html>
❌ Invalid: Multiple xmlns declarations
This older pattern with multiple namespace declarations is equally invalid in HTML5:
<html xmlns:og="http://ogp.me/ns#" xmlns:fb="http://ogp.me/ns/fb#">
Replace it with the single prefix attribute as shown in the examples above.
The xmlns:pcm attribute is an XML namespace declaration, and HTML doesn't allow prefixed namespace declarations on any element.
In XML, xmlns:pcm="urn:PageContentManager" binds the prefix pcm to that namespace, so names like pcm:item can appear inside the element. The HTML parser doesn't process namespace declarations. It keeps xmlns:pcm as a plain attribute with a colon in its name. The only namespace attribute an HTML element may have is xmlns, with the exact value http://www.w3.org/1999/xhtml. The validator reports xmlns:pcm wherever it appears, <html> included.
The attribute shows up in pages built with XSLT, such as SharePoint web parts. When an XSLT stylesheet writes out a literal element, it copies the namespace declarations in scope onto that element, except for the XSLT namespace itself and any prefix listed in exclude-result-prefixes. If you can edit the stylesheet, add pcm to that list:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:pcm="urn:PageContentManager"
exclude-result-prefixes="pcm">
Browsers do nothing with the attribute, so removing it doesn't change how the page looks or works.
Invalid example
<div class="news-list" xmlns:pcm="urn:PageContentManager">
<ul>
<li><a href="/news/opening-hours">Opening hours change</a></li>
</ul>
</div>
Valid example
<div class="news-list">
<ul>
<li><a href="/news/opening-hours">Opening hours change</a></li>
</ul>
</div>
The xmlns:rdf attribute declares the RDF namespace that SVG editors use for the metadata block in a drawing, and HTML doesn't allow prefixed namespace declarations on <svg> or any other element.
Inkscape SVG files, such as those saved by Inkscape 0.92, declare xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" on the root <svg> element, next to xmlns:dc and xmlns:cc. RDF (Resource Description Framework) is the W3C model for describing things as statements, and the rdf: namespace holds its core terms. Inkscape uses them to build the <metadata> block. <rdf:RDF> wraps the description, rdf:about="" says it is about this file, and rdf:resource gives a property a URI as its value, such as the Dublin Core type StillImage. The title and format are Dublin Core (dc:) terms, and the license is a Creative Commons (cc:) one. In a standalone .svg file, which is XML, all of this is valid.
Inline the file in an HTML page and the block stops being RDF. The HTML parser doesn't process namespace declarations, so xmlns:rdf is a plain attribute with a colon in its name, and the validator reports it on <svg>, on <html> and on any other element. The elements lose their namespace too. <rdf:RDF> becomes an SVG element named rdf:rdf, which the validator reports as a completely-unknown element, along with every element nested in it.
Delete xmlns:rdf together with the <metadata> block. Removing only the declaration leaves all those unknown-element errors in place. Nothing in the block is drawn, so the image doesn't change. The same export usually declares xmlns:dc, xmlns:cc, xmlns:sodipodi and xmlns:inkscape too. Each gets its own message, and they all go in the same cleanup.
If the page needs machine-readable facts about the image, such as who made it or what license it has, describe it in JSON-LD instead. A <script type="application/ld+json"> block with a schema.org ImageObject can hold creator and license, and its contentUrl points at the image file, for example the original .svg with its metadata intact. Google's image metadata documentation asks for contentUrl plus at least one of creator, creditText, copyrightNotice or license.
On <html>, xmlns:rdf is a leftover from XHTML+RDFa 1.0, which declared prefixes with xmlns:. RDFa 1.1 uses the prefix attribute instead, and rdf is one of its predefined prefixes, so you can delete the declaration without adding anything in its place.
To keep the declaration out of inlined SVGs, run them through SVGO first. Its default preset includes removeEditorsNSData, whose list of editor namespaces contains RDF, and removeMetadata, which drops the <metadata> block.
Invalid example
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
width="240" height="160" viewBox="0 0 240 160">
<metadata>
<rdf:RDF>
<rdf:Description rdf:about="">
<dc:title>Route map</dc:title>
<dc:creator>Jane Doe</dc:creator>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</rdf:Description>
</rdf:RDF>
</metadata>
<path d="M20 140L120 20L220 140" fill="none" stroke="currentColor" stroke-width="4" />
</svg>
Valid example
<svg width="240" height="160" viewBox="0 0 240 160" role="img">
<title>Route map</title>
<path d="M20 140L120 20L220 140" fill="none" stroke="currentColor" stroke-width="4" />
</svg>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "ImageObject",
"contentUrl": "https://example.com/images/route-map.svg",
"name": "Route map",
"creator": { "@type": "Person", "name": "Jane Doe" },
"license": "https://creativecommons.org/licenses/by/4.0/"
}
</script>
In HTML5, the only namespace attributes recognized on SVG elements are xmlns (for the SVG namespace) and xmlns:xlink (for XLink, though xlink is now largely deprecated in favor of plain attributes). Any other custom namespace declarations — such as xmlns:serif, xmlns:inkscape, or xmlns:sketch — are not permitted by the HTML specification and will trigger a validation error.
Design tools like Affinity Designer, Adobe Illustrator, Inkscape, and Sketch often embed proprietary namespace declarations and metadata attributes in exported SVG files. These serve as internal markers for the design application (for example, to preserve layer names or editor-specific settings) but have no meaning in a web browser. Browsers simply ignore them, so they add unnecessary bytes to your page without providing any benefit.
Removing these attributes is important for several reasons:
- Standards compliance: The HTML5 parser has a fixed list of allowed namespace declarations. Custom ones violate the spec.
- Clean markup: Proprietary metadata bloats your SVG files with information that only matters inside the originating design tool.
- Maintainability: Removing tool-specific artifacts makes your SVGs easier to read, edit, and optimize.
To fix this, open your SVG file (or the HTML file containing inline SVGs) and remove the xmlns:serif attribute from the <svg> element. You should also search for and remove any attributes prefixed with serif: (such as serif:id) throughout the SVG, since those depend on the now-removed namespace declaration.
For a more automated approach, consider using SVGO or similar SVG optimization tools, which strip out editor metadata and unnecessary namespace declarations by default.
Examples
Incorrect — custom namespace attribute present
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:serif="https://www.serif.com/"
viewBox="0 0 100 100">
<circle serif:id="MainCircle" cx="50" cy="50" r="40" fill="blue" />
</svg>
This triggers two types of errors: xmlns:serif is not allowed on the <svg> element, and serif:id is not a recognized attribute on <circle>.
Correct — custom namespace and prefixed attributes removed
<svg xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40" fill="blue" />
</svg>
Incorrect — multiple proprietary namespaces
Design tools sometimes add several custom namespaces at once:
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:serif="https://www.serif.com/"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 200 200">
<g serif:id="Layer1">
<rect x="10" y="10" width="80" height="80" fill="red" />
</g>
</svg>
Correct — only standard namespaces retained
<svg xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 200 200">
<g>
<rect x="10" y="10" width="80" height="80" fill="red" />
</g>
</svg>
Note that xmlns:xlink was also removed in this example. While it won't always trigger a validation error by itself, it's unnecessary if no xlink:href attributes are used — and modern HTML5 SVG usage favors plain href over xlink:href anyway.
The xmlns:sketch attribute declares the namespace the Sketch design app used for its layer data, and HTML doesn't allow prefixed namespace declarations on <svg> or any other element.
Sketch is a macOS design app from Bohemian Coding. Until version 3.6, it put xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" on the root <svg> of every SVG it exported. The prefix is there for the sketch:type attributes, which record what each element was in the Sketch document: MSPage on the page group, MSArtboardGroup on the artboard, MSLayerGroup on a group of layers and MSShapeGroup on each shape. Sketch 3.6, released in March 2016, dropped these prefixes to make its SVG exports smaller. An SVG that still carries them was exported before then and ended up in a page or template later.
The HTML parser doesn't handle namespace prefixes, so xmlns:sketch is a plain attribute with a colon in its name. The validator reports it on any element that carries it, whether that's <svg> or a <div>. Each sketch:type gets its own message too, such as Attribute "sketch:type" not allowed on element "path" at this point. Browsers ignore this markup, so removing it doesn't change how the icon looks.
Delete xmlns:sketch and every sketch:type attribute. Removing only the declaration leaves one error per sketch:type behind. Delete them together in a standalone .svg file too: if a sketch:type survives without its declaration, the file is no longer well-formed XML and browsers won't display it.
Sketch's export also copies the layer name into <title> and adds <desc>Created with Sketch.</desc>. Neither one is a validation error. In inline SVG, though, the browser uses <title> as the image's accessible name and <desc> as its description, so a screen reader can announce "Created with Sketch." Give the <title> a name that describes the icon, and delete the <desc>.
If a build step inlines your SVG files, SVGO removes the Sketch markup for you. Its default preset runs removeEditorsNSData, and http://www.bohemiancoding.com/sketch/ns is on that plugin's list of editor namespaces, so it deletes the declaration and every sketch: attribute. The preset's removeDesc plugin deletes a <desc> that starts with "Created with".
Invalid example
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<title>check</title>
<desc>Created with Sketch.</desc>
<g id="Page-1" stroke="none" fill="none" sketch:type="MSPage">
<g id="Icons" sketch:type="MSArtboardGroup">
<path d="M5 12l5 5L20 7" id="check" stroke="#000000" stroke-width="2" sketch:type="MSShapeGroup"></path>
</g>
</g>
</svg>
Valid example
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Checkmark</title>
<g id="Page-1" stroke="none" fill="none">
<g id="Icons">
<path d="M5 12l5 5L20 7" id="check" stroke="#000000" stroke-width="2"></path>
</g>
</g>
</svg>
The xmlns:sodipodi attribute declares the namespace for editor data that Inkscape inherited from Sodipodi, and HTML doesn't allow prefixed namespace declarations on <svg> or any other element.
Sodipodi was a vector drawing program written mainly by Lauris Kaplinski, and SVG was its native file format. In 2003 a group of its developers forked it to start Inkscape. Sodipodi itself stopped at version 0.34, released in February 2004. Inkscape kept the sodipodi: prefix for the features it inherited, so files saved by current versions still declare xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" on the root <svg>. The URI is only a name for the namespace. Nothing downloads that DTD.
The prefix marks editor state. <sodipodi:namedview>, a child of the root <svg>, keeps the document's view settings: page and border colors, the grid, zoom and window position, the current layer, and any guide lines as <sodipodi:guide> children. On the root element, sodipodi:docname records the file name the drawing was last saved under.
Shapes and text carry their own sodipodi: attributes. sodipodi:nodetypes on a path has one letter per node (c for cusp, s for smooth, z for symmetric, a for auto-smooth), which the node tool reads to decide how a node's handles move. sodipodi:type marks a path drawn with a shape tool, such as star, arc or spiral, and attributes like sodipodi:sides and sodipodi:r1 keep the shape's parameters so Inkscape can bring its handles back. Lines of text get sodipodi:role="line" on their <tspan>. Browsers ignore all of it, and a star is drawn from the path's d attribute like any other path.
The HTML parser doesn't link prefixes to declarations. To it, xmlns:sodipodi is one attribute with a colon in its name and sodipodi:docname is another, and nothing connects the two. Delete only the declaration and every other sodipodi: name still fails on its own. The invalid example below gets 13 errors, and only one of them is about xmlns:sodipodi. The other 12 come from the sodipodi: attributes, such as Attribute "sodipodi:type" not allowed on element "path" at this point., and from <sodipodi:namedview> and <sodipodi:guide>, which the validator reports as completely-unknown elements in SVG content.
Delete xmlns:sodipodi, the <sodipodi:namedview> element with everything inside it, and every attribute that starts with sodipodi:. The image looks the same afterwards. Only Inkscape notices: the guides, grid and page settings are gone, and stars and spirals reopen as plain paths. Keep the original file for editing and put a cleaned copy in the page.
The same Inkscape file usually declares xmlns:inkscape, xmlns:rdf, xmlns:cc and xmlns:dc too, and each gets its own message. SVGO's removeEditorsNSData plugin, part of its default preset, removes the Sodipodi declaration and every sodipodi: element and attribute, and does the same for those four namespaces. If the whole file was pasted in, its <?xml version="1.0"?> line comes along too, and the validator reports it as an XML processing instruction.
Invalid example
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
sodipodi:docname="star.svg"
width="24" height="24" viewBox="0 0 24 24">
<sodipodi:namedview pagecolor="#ffffff" showgrid="false">
<sodipodi:guide position="12,12" orientation="1,0" />
</sodipodi:namedview>
<path sodipodi:type="star" sodipodi:sides="5"
sodipodi:cx="12" sodipodi:cy="12" sodipodi:r1="10" sodipodi:r2="4"
sodipodi:arg1="-1.5708" sodipodi:arg2="-0.9425"
d="M12,2 14.35,8.76 21.51,8.91 15.8,13.24 17.88,20.09 12,16 6.12,20.09 8.2,13.24 2.49,8.91 9.65,8.76Z"
fill="currentColor" />
</svg>
Valid example
<svg xmlns="http://www.w3.org/2000/svg"
width="24" height="24" viewBox="0 0 24 24">
<path d="M12,2 14.35,8.76 21.51,8.91 15.8,13.24 17.88,20.09 12,16 6.12,20.09 8.2,13.24 2.49,8.91 9.65,8.76Z"
fill="currentColor" />
</svg>
The xmlns:style attribute declares an XML namespace prefix, and HTML elements don't accept namespace declarations other than xmlns itself.
In XML, xmlns:style="..." binds the prefix style to a namespace URI, so the document can use names like style:font. The HTML parser doesn't process namespace declarations. It reads xmlns:style as an ordinary attribute with an unusual name and does nothing with it. The one namespace attribute an HTML element may have is xmlns, and only with the exact value http://www.w3.org/1999/xhtml. The validator rejects prefixed declarations like xmlns:style on every HTML element, <html> included.
The attribute usually comes from markup generated with XML tools. An XSLT stylesheet, for example, copies the namespace declarations in scope onto each literal element it outputs, unless the prefix is listed in exclude-result-prefixes:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:style="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="style">
When a template repeats the declaration on the same element, the validator also reports a duplicate attribute error. Removing xmlns:style fixes both, and the page renders the same because the attribute has no effect in browsers.
Invalid example
<div class="top-bar" xmlns:style="http://www.w3.org/1999/xhtml">
<a href="/">Home</a>
</div>
Valid example
<div class="top-bar">
<a href="/">Home</a>
</div>
In HTML5, SVG elements are natively supported and don't require explicit namespace declarations at all. When you write an <svg> tag inside an HTML document, the browser automatically associates it with the correct SVG namespace (http://www.w3.org/2000/svg). The xmlns:svg="http://www.w3.org/2000/svg" attribute is a prefixed namespace binding — it declares svg as a namespace prefix — which is a concept from XML/XHTML workflows that HTML5's parser does not support or recognize.
The HTML specification defines a limited set of allowed attributes on each element. Since xmlns:svg is not among them for the <svg> element (or any HTML5 element), the W3C validator flags it as invalid. The only namespace-related attribute the HTML parser tolerates on <svg> is xmlns="http://www.w3.org/2000/svg", and even that is optional — it's accepted purely for compatibility with XHTML but has no functional effect in HTML5.
This issue commonly appears when SVG code is exported from graphic editors like Inkscape or Adobe Illustrator, or when SVG files originally written as standalone XML documents are pasted directly into HTML. These tools sometimes include verbose namespace declarations that are necessary in XML contexts but invalid in HTML.
Why it matters
- Standards compliance: The HTML5 specification explicitly does not allow prefixed namespace attributes. Using them results in validation errors.
- Code cleanliness: Unnecessary attributes add clutter without any benefit, making your markup harder to read and maintain.
- Potential parsing issues: While most browsers silently ignore unrecognized attributes, relying on lenient browser behavior rather than valid markup can lead to unexpected results in edge cases or non-browser HTML consumers (e.g., email clients, content scrapers, or accessibility tools).
How to fix it
- Locate all
<svg>elements in your HTML that contain thexmlns:svgattribute. - Remove the
xmlns:svg="http://www.w3.org/2000/svg"attribute entirely. - If you're working in an HTML5 document (not XHTML), the
xmlns="http://www.w3.org/2000/svg"attribute is also optional — you can keep or remove it. - If your SVG uses other prefixed namespace declarations like
xmlns:xlink, consider replacing them with their HTML5 equivalents (e.g., usehrefinstead ofxlink:href).
Examples
Incorrect: using xmlns:svg on an SVG element
The xmlns:svg attribute triggers the validation error:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40" fill="blue" />
</svg>
Correct: removing the prefixed namespace
Remove xmlns:svg and keep only the standard attributes:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40" fill="blue" />
</svg>
Also correct: minimal inline SVG in HTML5
In HTML5, the xmlns attribute itself is optional for inline SVG, so this is the cleanest approach:
<svg viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40" fill="blue" />
</svg>
Cleaning up multiple unnecessary namespaces
SVG exported from editors often includes several unnecessary namespace declarations. Here's a before-and-after of a typical cleanup:
Before (multiple invalid namespace attributes):
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 200 200">
<image xlink:href="photo.jpg" width="200" height="200" />
</svg>
After (cleaned up for HTML5):
<svg viewBox="0 0 200 200">
<image href="photo.jpg" width="200" height="200" />
</svg>
Note that xlink:href has been replaced with href, which is the modern standard supported by all current browsers. The xmlns:xlink declaration is no longer needed either.
The xmlns:v attribute declares the XML namespace urn:schemas-microsoft-com:vml, which enabled Microsoft's proprietary Vector Markup Language in Internet Explorer versions 5 through 8. VML was a way to render vector shapes directly in HTML before SVG gained broad browser support. When working with XML-based documents (like XHTML), namespace declarations such as xmlns:v were syntactically valid. However, HTML5 is not an XML language — it has its own parsing rules and only recognizes a limited set of namespace declarations on the <html> element, specifically xmlns (for the default XHTML namespace) and xmlns:xlink (in certain SVG/MathML contexts). Any other xmlns:* attribute, including xmlns:v, xmlns:o, and xmlns:w, triggers a validation error.
Why This Is a Problem
Standards compliance: The HTML5 specification explicitly does not allow arbitrary XML namespace declarations. The W3C validator flags xmlns:v because it is not part of the HTML5 attribute set for any element.
No modern browser support: VML was only supported in Internet Explorer, which has been discontinued. No current browser renders VML content, so the namespace declaration serves no purpose.
Code cleanliness: Keeping legacy, non-functional attributes clutters your markup and can confuse developers who maintain the code. It may also cause issues with HTML parsers, linters, and build tools that enforce strict HTML5 compliance.
How to Fix It
- Remove the
xmlns:vattribute from your<html>tag (or wherever it appears). - Remove any related namespace attributes like
xmlns:o(Office namespace) orxmlns:w(Word namespace), which are also invalid in HTML5 and often appear alongsidexmlns:v. - Replace VML content with SVG if your page relied on VML for vector graphics. SVG is natively supported in all modern browsers and requires no namespace declaration on the
<html>element. - Ensure the
langattribute is set on the<html>element for accessibility, since you're already editing that line.
Examples
Invalid: Using xmlns:v on the html element
<!DOCTYPE html>
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word">
<head>
<title>My Page</title>
</head>
<body>
<p>Hello world</p>
</body>
</html>
This triggers multiple validation errors — one for each xmlns:* attribute that HTML5 does not recognize.
Valid: Namespace attributes removed
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Page</title>
</head>
<body>
<p>Hello world</p>
</body>
</html>
Replacing VML with SVG
If your page used VML to draw shapes, replace the VML markup with inline SVG. No namespace declaration on <html> is needed — the <svg> element carries its own namespace implicitly in HTML5.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Vector Graphics with SVG</title>
</head>
<body>
<svg width="200" height="200" aria-label="Blue circle">
<circle cx="100" cy="100" r="80" fill="steelblue" />
</svg>
</body>
</html>
Common Sources of This Issue
This attribute frequently appears in HTML that was:
- Exported from Microsoft Word or Outlook. These applications generate HTML with VML namespace declarations for shapes, text effects, and email formatting.
- Copied from legacy templates. Older website templates and email templates sometimes included VML for rounded corners or background images in Internet Explorer.
- Generated by outdated WYSIWYG editors that targeted older IE versions.
If you're working with HTML email templates, note that some email clients (notably older Outlook desktop versions) still use the Word rendering engine and may rely on VML for certain effects like background images. In that context, you may intentionally keep VML in your email source — but be aware that the markup will not pass HTML5 validation. For web pages, there is no reason to retain these attributes.
In HTML5, the only namespace-related attribute permitted on the <html> element is xmlns with the value http://www.w3.org/1999/xhtml, and even that is optional—it exists solely for compatibility with XHTML serialization. Prefixed namespace declarations like xmlns:w, xmlns:o, xmlns:v, and similar attributes are XML features that have no meaning in the HTML syntax. They originate from Microsoft Office's HTML export, which generates markup containing proprietary XML namespaces such as urn:schemas-microsoft-com:office:word for Word-specific elements and styling.
Why This Is a Problem
Standards compliance: The HTML living standard (WHATWG) explicitly does not support custom namespace declarations. Including them makes your document non-conforming, and the W3C validator will report an error for each one.
No browser benefit: Modern browsers parsing HTML5 ignore these namespace declarations entirely. The attributes serve no functional purpose on the web—they only add unnecessary bloat to your markup.
Maintenance and readability: Office-generated HTML is notoriously verbose. Leaving namespace declarations in place often goes hand-in-hand with other Office artifacts (conditional comments, <o:p> tags, mso- style properties) that clutter your code and make it harder to maintain.
Accessibility and interoperability: While browsers typically tolerate these extra attributes without visible issues, non-browser HTML consumers—such as screen readers, search engine crawlers, or email clients—may handle unexpected attributes unpredictably.
How to Fix It
- Remove the
xmlns:wattribute from your<html>tag or any other element where it appears. - Remove related namespace declarations like
xmlns:o(Office),xmlns:v(VML), andxmlns:m(Math) if present. - Clean up Office-specific elements such as
<w:Sdt>,<o:p>, or<v:shape>that depend on those namespaces—these are not valid HTML elements. - Strip Office-specific CSS properties prefixed with
mso-(e.g.,mso-bidi-font-family) that often accompany namespace declarations.
If you regularly paste content from Microsoft Word, consider using a "paste as plain text" feature in your editor, or use an HTML cleaning tool to strip Office artifacts automatically.
Examples
Invalid: Office namespace on the <html> element
<!DOCTYPE html>
<html lang="en" xmlns:w="urn:schemas-microsoft-com:office:word">
<head>
<title>Document</title>
</head>
<body>
<p>Content from Word</p>
</body>
</html>
Invalid: Multiple Office namespaces
<!DOCTYPE html>
<html lang="en"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>Document</title>
</head>
<body>
<p class="MsoNormal">Content from Word<o:p></o:p></p>
</body>
</html>
Valid: Clean HTML without namespace declarations
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<p>Content from Word</p>
</body>
</html>
Valid: Using the standard xmlns attribute (optional)
If you need XHTML compatibility, the standard xmlns attribute (without a prefix) is permitted:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Document</title>
</head>
<body>
<p>Content from Word</p>
</body>
</html>
Note that this same validation error applies to any custom prefixed namespace attribute—not just xmlns:w. If you see similar errors for xmlns:o, xmlns:v, xmlns:st1, or others, the fix is the same: remove them along with any elements or attributes that depend on those namespaces.
The xmlns:web attribute is an XML namespace declaration for a web prefix, and HTML doesn't allow prefixed namespace declarations on any element.
In XML, xmlns:web="http://example.com/schemas/web/" binds the prefix web to a namespace, so names like web:result can appear in the document. The URI identifies the namespace, and web is only a short alias the template's author picked. On the root <html> tag, the declaration is typically left over from a template first written as XHTML, where it sat next to xmlns="http://www.w3.org/1999/xhtml" and xml:lang.
The HTML parser doesn't process namespace declarations. It keeps xmlns:web as a plain attribute with a colon in its name, and it lowercases the name, so the validator reports xmlns:web even when the source says xmlns:Web. The only namespace attribute HTML accepts is xmlns, with the exact value http://www.w3.org/1999/xhtml. That one is allowed but does nothing in an HTML page, so you can keep it or drop it.
Delete xmlns:web from the tag. Browsers don't act on the declaration, so removing it doesn't change how the page looks or works. If the markup also has web: attributes, the validator reports each of them as not allowed. Move that data into data-* attributes, or remove it if nothing reads it.
Invalid example
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:Web="http://example.com/schemas/web/">
<head>
<title>Search results</title>
</head>
<body>
<p>Results for your search.</p>
</body>
</html>
Valid example
<!DOCTYPE html>
<html lang="en">
<head>
<title>Search results</title>
</head>
<body>
<p>Results for your search.</p>
</body>
</html>
An attribute like xmlns:news or xmlns:x declares an XML namespace prefix, and HTML doesn't accept prefixed namespace declarations, except xmlns:xlink on SVG and MathML elements.
In XML, xmlns:news="http://example.com/modules/news" binds the prefix news to a namespace URI, so names like news:item can appear in the document. The HTML parser doesn't process namespace declarations. It keeps the declaration as a plain attribute with a colon in its name, and it lowercases that name, so xmlns:Foo in the source shows up as xmlns:foo in the message. The validator reports it the same way whatever the prefix is and whichever element carries it, <html> included. On HTML elements the only namespace attribute allowed is xmlns, with the exact value http://www.w3.org/1999/xhtml. Inline <svg> and <math> also accept xmlns:xlink="http://www.w3.org/1999/xlink", and no other prefix.
Pages built with XSLT, as many CMS modules are, often carry these declarations on a <div> or on <html>. When an XSLT stylesheet writes out a literal element, it copies the namespace declarations in scope onto that element, except for the XSLT namespace itself and any prefix listed in exclude-result-prefixes. If you can edit the stylesheet, add the prefix to that list:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:news="http://example.com/modules/news"
exclude-result-prefixes="news">
Inline SVG pasted from Adobe Illustrator brings its own set: xmlns:x, xmlns:i and xmlns:graph on the root <svg>, pointing to Adobe's Extensibility, Illustrator and Graphs namespaces, and in older files xmlns:a for the Adobe SVG Viewer plugin. In the original .svg file the values are often entity references like &ns_ai;, defined in the file's DOCTYPE, so they don't resolve to anything once the markup sits inside an HTML page. Delete the declarations along with any attributes that use those prefixes, such as i:extraneous="self" on a <g>, which the validator reports as a separate error. If a build step inlines your SVGs, SVGO's removeEditorsNSData plugin, part of its default preset, removes Adobe's namespaces and the attributes that use them.
Browsers ignore these declarations in HTML, so removing them doesn't change how the page looks or works.
Invalid example
<div class="news-list" xmlns:news="http://example.com/modules/news">
<p>Latest news</p>
</div>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:x="http://ns.adobe.com/Extensibility/1.0/"
xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/"
xmlns:graph="http://ns.adobe.com/Graphs/1.0/"
width="24" height="24" viewBox="0 0 24 24">
<path d="M5 12l5 5L20 7" fill="none" stroke="currentColor" stroke-width="2" />
</svg>
Valid example
<div class="news-list">
<p>Latest news</p>
</div>
<svg xmlns="http://www.w3.org/2000/svg"
width="24" height="24" viewBox="0 0 24 24">
<path d="M5 12l5 5L20 7" fill="none" stroke="currentColor" stroke-width="2" />
</svg>
The < character is the opening delimiter for HTML tags. When the browser's HTML parser encounters <, it expects a valid tag name to follow (like div, p, span, etc.). If it instead finds an unexpected character—a digit, a symbol, a space, or anything that doesn't form a recognized tag—the parser enters an error state. The validator flags this because the < was almost certainly meant as literal content, not as the start of a tag.
This issue commonly appears in several scenarios:
- Mathematical or comparison expressions like
x < yorif (count < 10) - Inline code or technical content that includes angle brackets, such as explaining generics (
List<String>) or template syntax - User-generated content or CMS output where text hasn't been properly HTML-encoded
- Copy-pasting code snippets directly into HTML without escaping
Beyond triggering validation errors, unescaped < characters can cause real rendering problems. The browser may try to interpret the text following < as a tag, swallowing part of your visible content or producing unexpected DOM structures. This can also create accessibility issues, as screen readers rely on a well-formed DOM to convey content accurately.
How to fix it
Replace every < that appears as content (not as part of an actual HTML tag) with the HTML entity <. Similarly, replace literal > with >. While > doesn't always cause validation errors, escaping both characters is a best practice that prevents ambiguity and keeps your markup clean.
If you're writing code examples, wrap them in <code> or <pre> elements—but note that you still need to escape < and > inside those elements. The <pre> and <code> tags preserve whitespace and indicate code semantics, but they do not disable HTML parsing.
Examples
❌ Bad: unescaped < in a math expression
<p>Check if x < 10 before proceeding.</p>
The parser sees < 10 and tries to interpret 10 as a tag name, triggering the error.
✅ Fixed: escaped with <
<p>Check if x < 10 before proceeding.</p>
❌ Bad: unescaped angle brackets in a code snippet
<pre><code>
List<String> names = new ArrayList<String>();
</code></pre>
The parser interprets <String> as an unknown HTML tag, breaking the content.
✅ Fixed: all angle brackets escaped inside <code>
<pre><code>
List<String> names = new ArrayList<String>();
</code></pre>
❌ Bad: unescaped < in a conditional expression
<p>The expression 1 < 2 && 3 > 1 evaluates to true.</p>
✅ Fixed: both < and > escaped
<p>The expression 1 < 2 && 3 > 1 evaluates to true.</p>
Note that && also needs to be escaped as && because & is itself a reserved character in HTML.
Quick reference for common HTML entities
| Character | Entity | Description |
|---|---|---|
< | < | Less-than sign |
> | > | Greater-than sign |
& | & | Ampersand |
" | " | Double quotation mark |
If you're generating HTML dynamically (via JavaScript, a server-side language, or a CMS), make sure your output pipeline includes an HTML-encoding step. Most frameworks and template engines provide a built-in escaping function—use it for any user-supplied or variable content that gets inserted into HTML.
The <noscript> element behaves differently depending on where it appears in a document. When placed inside the <head>, it can only contain <link>, <style>, and <meta> elements — strictly metadata content. When placed inside the <body>, it can contain any flow content, including <p>, <div>, <iframe>, and more. This distinction is defined in the WHATWG HTML Living Standard.
When the validator encounters an <iframe> inside a <noscript> in the <head>, it reports "Bad start tag" because the parser is operating under the <head> content model, where <iframe> is simply not a valid element. The browser may attempt error recovery by implicitly closing the <head> and opening the <body>, but this can lead to unexpected DOM structures and layout issues.
This pattern commonly appears when adding tracking or analytics snippets. For instance, Google Tag Manager provides a <noscript> fallback containing an <iframe>, and it's meant to be placed immediately after the opening <body> tag — not in the <head>. Placing it in the wrong location breaks validation and may cause the tracking pixel to malfunction.
To fix the error, identify any <noscript> blocks in your <head> that contain non-metadata elements (like <iframe>, <p>, <div>, <img>, etc.) and move them into the <body>. If the <noscript> block only needs metadata elements like <meta> or <style>, it can remain in the <head>.
Examples
Invalid: iframe inside noscript in head
The <iframe> is not valid metadata content, so it cannot appear inside <noscript> within the <head>.
<!DOCTYPE html>
<html lang="en">
<head>
<title>My webpage</title>
<noscript>
<iframe src="https://example.com/tracking"></iframe>
</noscript>
</head>
<body>
<h1>Welcome</h1>
</body>
</html>
Fixed: noscript with iframe moved to body
Moving the <noscript> block into the <body> resolves the error, since flow content is allowed there.
<!DOCTYPE html>
<html lang="en">
<head>
<title>My webpage</title>
</head>
<body>
<noscript>
<iframe src="https://example.com/tracking"></iframe>
</noscript>
<h1>Welcome</h1>
</body>
</html>
Valid: metadata-only noscript in head
A <noscript> block that contains only metadata elements is perfectly valid inside the <head>.
<!DOCTYPE html>
<html lang="en">
<head>
<title>My webpage</title>
<noscript>
<meta http-equiv="refresh" content="0; url=https://example.com/nojs">
<style>
.js-only { display: none; }
</style>
</noscript>
</head>
<body>
<h1>Welcome</h1>
</body>
</html>
Fixed: splitting a mixed noscript between head and body
If you need both metadata and flow content in your <noscript> fallback, use two separate <noscript> blocks — one in the <head> for metadata, and one in the <body> for visible content.
<!DOCTYPE html>
<html lang="en">
<head>
<title>My webpage</title>
<noscript>
<style>
.js-only { display: none; }
</style>
</noscript>
</head>
<body>
<noscript>
<p>Please enable JavaScript to view this website.</p>
<iframe src="https://example.com/tracking"></iframe>
</noscript>
<h1>Welcome</h1>
</body>
</html>
The <noscript> element provides fallback content for users whose browsers don't support scripting or have JavaScript disabled. When <noscript> appears inside <head>, the HTML specification restricts its contents to metadata elements only — specifically <link>, <style>, and <meta>. An <img> tag is flow content, not metadata content, so it is not permitted inside <head> regardless of whether it's wrapped in <noscript>.
When <noscript> appears inside <body>, however, it can contain any flow content that would normally be valid at that position — including <img> elements. This is why the fix is simply to relocate the <noscript> block from the <head> to the <body>.
This issue is extremely common with third-party tracking pixels. Services like Facebook Pixel, LinkedIn Insight Tag, Google Tag Manager, and similar tools often instruct you to paste a <noscript> block containing a 1×1 tracking <img> directly after the opening <head> tag. While this works in browsers (they are forgiving with invalid HTML), it does not conform to the HTML specification and will trigger a validation error.
Beyond standards compliance, keeping your HTML valid ensures predictable behavior across all browsers and assistive technologies. Invalid markup can lead to unexpected DOM construction, which may cause subtle issues with CSS selectors, JavaScript DOM queries, or accessibility tools.
How to Fix It
- Locate the
<noscript>block that contains the<img>element inside your<head>. - Move that entire
<noscript>block to somewhere inside the<body>— typically right after the opening<body>tag. - Keep any associated
<script>tag in the<head>if desired; only the<noscript>with the<img>needs to move.
Examples
❌ Invalid: <img> inside <noscript> in <head>
This is the pattern commonly provided by third-party tracking pixel instructions:
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Page</title>
<script>
/* tracking script */
</script>
<noscript>
<img src="https://example.com/pixel?id=123" height="1" width="1" alt="">
</noscript>
</head>
<body>
<h1>Welcome</h1>
</body>
</html>
The validator reports "Bad start tag in img in noscript in head" because <img> is not valid metadata content.
✅ Valid: <noscript> with <img> moved to <body>
Move the <noscript> block into the <body> while leaving the <script> in the <head>:
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Page</title>
<script>
/* tracking script */
</script>
</head>
<body>
<noscript>
<img src="https://example.com/pixel?id=123" height="1" width="1" alt="">
</noscript>
<h1>Welcome</h1>
</body>
</html>
The <img> is now inside <body> (via <noscript>), where flow content is permitted. The tracking pixel will still function correctly for users with JavaScript disabled.
✅ Valid: metadata-only <noscript> in <head>
If you only need metadata fallback content in the <head>, elements like <meta>, <link>, and <style> are allowed:
<head>
<title>My Page</title>
<noscript>
<style>
.js-only { display: none; }
</style>
</noscript>
</head>
This is valid because <style> is metadata content. Use this pattern when you need to apply fallback styles for non-JavaScript users, and reserve <noscript> blocks with <img> or other flow content for the <body>.
The HTML specification defines two distinct content models for the <noscript> element based on its location in the document. When <noscript> appears inside <head>, it inherits the restrictions of the <head> element itself — only metadata content is permitted. This means elements like <link>, <style>, and <meta> are allowed, but flow content like <p>, <div>, <h1>, or any other body-level element is not. When <noscript> appears inside <body>, it follows the more permissive rules of flow content and can contain paragraphs, headings, and other visible elements.
This distinction exists because the <head> section is strictly reserved for metadata that describes the document — it is never rendered as visible page content. Placing a <p> tag inside a <noscript> in <head> violates this principle. Browsers may handle this inconsistently: some might silently ignore the invalid content, while others might force the <head> to close prematurely and push the content into the <body>, causing unexpected layout issues and potentially disrupting other metadata elements that follow.
This is also an accessibility concern. Screen readers and other assistive technologies rely on a well-structured document where the <head> contains only metadata and all visible content lives in the <body>. Invalid nesting can confuse these tools and lead to content being skipped or misinterpreted.
How to Fix It
You have two main approaches:
Keep
<noscript>in<head>but use only metadata elements. This is ideal when you need to load a fallback stylesheet or add a<meta>redirect for users without JavaScript.Move the
<noscript>block into<body>if you need to display visible text or other flow content to the user.
Examples
❌ Incorrect: Flow content inside <noscript> in <head>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example</title>
<noscript>
<p>JavaScript is disabled.</p>
</noscript>
</head>
<body>
</body>
</html>
The <p> element is flow content and is not allowed inside <noscript> when it sits within <head>.
✅ Correct: Metadata-only <noscript> in <head>
If your goal is to provide a fallback stylesheet or redirect when JavaScript is unavailable, use only metadata elements:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example</title>
<noscript>
<link rel="stylesheet" href="no-js-fallback.css">
</noscript>
</head>
<body>
</body>
</html>
You can also use <style> or <meta> inside the <noscript> in <head>:
<head>
<title>Example</title>
<noscript>
<style>
.js-only { display: none; }
.no-js-message { display: block; }
</style>
</noscript>
</head>
✅ Correct: Textual fallback in <noscript> inside <body>
When you need to show a visible message to users who have JavaScript disabled, place the <noscript> block in the <body>:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example</title>
</head>
<body>
<noscript>
<p>This site requires JavaScript to function properly. Please enable JavaScript in your browser settings.</p>
</noscript>
</body>
</html>
✅ Correct: Combining both approaches
For a comprehensive fallback strategy, you can use <noscript> in both locations — metadata in <head> and visible content in <body>:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example</title>
<noscript>
<link rel="stylesheet" href="no-js-fallback.css">
</noscript>
</head>
<body>
<noscript>
<p>JavaScript is disabled. Some features may not be available.</p>
</noscript>
</body>
</html>
This gives you the best of both worlds: styling adjustments via the <head> fallback and a user-facing message via the <body> fallback.
The <title> element can't go inside a <noscript> block in the <head>, because a <noscript> there accepts only <link>, <style> and <meta> elements.
The validator reads the page the way a browser with JavaScript turned off would. In that mode, a <title> start tag inside a <noscript> in the <head> makes the parser close the <noscript> early and handle the <title> as if it sat directly in the <head>. The </noscript> end tag then has nothing left to close, so the validator usually reports a stray </noscript> end tag right after this error.
Browsers with JavaScript turned on do the opposite: they read everything inside a <noscript> as plain text and ignore it. The same markup gives the page a title for some visitors and none for others. The document title shouldn't depend on scripting. Screen readers announce it when the page loads, and browsers show it in tabs and bookmarks.
Move the <title> out of the <noscript> so it sits directly in the <head>. If the page already has a <title>, delete the one inside <noscript> instead, since a document can have only one. When the <noscript> was meant to show a message to visitors without JavaScript, put that message in a <noscript> inside the <body>, where visible content is allowed.
Invalid example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="app.js"></script>
<noscript>
<title>Product catalog</title>
</noscript>
</head>
<body>
<h1>Product catalog</h1>
</body>
</html>
Valid example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Product catalog</title>
<script src="app.js"></script>
</head>
<body>
<noscript>
<p>Turn on JavaScript to use the catalog filters.</p>
</noscript>
<h1>Product catalog</h1>
</body>
</html>
The aria-rowspan attribute is used in ARIA-based grid and table structures to indicate how many rows a cell spans. It serves a similar purpose to the rowspan attribute on native HTML <td> and <th> elements, but is designed for custom widgets built with ARIA roles like gridcell, rowheader, and columnheader within grid or treegrid structures.
According to the WAI-ARIA specification, the value of aria-rowspan must be a positive integer — a whole number greater than zero. A value of "0" is invalid because it implies the cell spans no rows, which is semantically meaningless. Note that this differs from native HTML's rowspan attribute, where "0" has a special meaning (span all remaining rows in the row group). The ARIA attribute does not support this behavior.
This matters primarily for accessibility. Screen readers and other assistive technologies rely on aria-rowspan to convey the structure of custom grids to users. An invalid value of "0" can confuse assistive technology, potentially causing it to misrepresent the grid layout or skip the cell entirely. Ensuring valid values helps users who depend on these tools navigate your content correctly.
To fix this issue, determine how many rows the cell actually spans and set aria-rowspan to that number. If the cell occupies a single row, use "1". If it spans multiple rows, use the appropriate count. If you don't need row spanning at all, you can simply remove the aria-rowspan attribute entirely, since the default behavior is to span one row.
Examples
Incorrect: aria-rowspan set to zero
<div role="grid">
<div role="row">
<div role="gridcell" aria-rowspan="0">Name</div>
<div role="gridcell">Value</div>
</div>
</div>
The value "0" is not a positive integer, so the validator reports an error.
Correct: aria-rowspan set to a positive integer
If the cell spans a single row, use "1" (or remove the attribute, since one row is the default):
<div role="grid">
<div role="row">
<div role="gridcell" aria-rowspan="1">Name</div>
<div role="gridcell">Value</div>
</div>
</div>
Correct: aria-rowspan for a cell spanning multiple rows
If the cell genuinely spans two rows, set the value accordingly:
<div role="grid">
<div role="row">
<div role="gridcell" aria-rowspan="2">Category</div>
<div role="gridcell">Item A</div>
</div>
<div role="row">
<div role="gridcell">Item B</div>
</div>
</div>
Correct: removing the attribute when no spanning is needed
If the cell doesn't span multiple rows, the simplest fix is to remove aria-rowspan altogether:
<div role="grid">
<div role="row">
<div role="gridcell">Name</div>
<div role="gridcell">Value</div>
</div>
</div>
When to use aria-rowspan vs. native HTML
If you're building a data table, prefer native HTML <table>, <tr>, <td>, and <th> elements with the standard rowspan attribute. Native table semantics are automatically understood by browsers and assistive technologies without any ARIA attributes. Reserve aria-rowspan for custom interactive widgets (like spreadsheet-style grids or tree grids) where native table elements aren't appropriate. The aria-rowspan value should always match the actual visual and structural layout of your grid to avoid confusing assistive technology users.
The step attribute specifies the granularity that an input's value must adhere to. It controls the increment when a user clicks the up/down spinner buttons on a number input, moves a slider on a range input, or adjusts date and time inputs. The browser also uses this value during constraint validation to determine which values are considered valid based on the stepping base (typically the min value or the input's default).
When the HTML specification defines the step attribute, it requires the value to be a valid floating-point number greater than zero. A value of "0" is explicitly invalid because a step of zero means no increment at all — it's logically meaningless. You can't step through values in increments of nothing. The W3C validator flags this as an error because "0" fails the requirement of being a positive number.
Why this matters
- Standards compliance: The WHATWG HTML living standard explicitly requires
stepto parse as a number greater than zero. A value of"0"violates this rule. - Browser behavior: While browsers may not crash on
step="0", the behavior becomes unpredictable. Spinner buttons may stop working, and form validation may not function as expected. - Accessibility: Assistive technologies rely on correct
stepvalues to communicate valid input ranges to users. An invalid step can lead to a confusing experience.
How to fix it
Choose the appropriate fix depending on your intent:
- If you want specific increments (e.g., whole numbers, cents, tenths), set
stepto the desired interval like"1","0.01", or"0.1". - If you want to allow any value with no stepping constraint, use the special keyword
step="any". This tells the browser that no stepping is implied and any floating-point value is acceptable. - If you don't need the attribute at all, simply remove it. Each input type has a default step value (e.g.,
1fortype="number").
Examples
❌ Invalid: step set to zero
<label for="price">Price:</label>
<input id="price" name="price" type="number" step="0" min="0">
This triggers the validation error because "0" is not a valid positive floating-point number.
✅ Fixed: using a specific step value
If you want the input to accept values in increments of one cent:
<label for="price">Price:</label>
<input id="price" name="price" type="number" step="0.01" min="0">
Valid values would include 0, 0.01, 0.02, 1.50, 99.99, and so on.
✅ Fixed: using step="any" for unrestricted precision
If you want to allow any numeric value without stepping constraints:
<label for="price">Price:</label>
<input id="price" name="price" type="number" step="any" min="0">
This permits any floating-point value, such as 3.14159 or 0.007.
✅ Fixed: using a whole number step with a non-zero minimum
<label for="quantity">Quantity:</label>
<input id="quantity" name="quantity" type="number" step="2" min="1.3">
With step="2" and min="1.3", valid values include 1.3, 3.3, 5.3, 7.3, and so on. The stepping base is 1.3, and each valid value is an even multiple of 2 away from it.
✅ Fixed: removing the attribute entirely
If the default step behavior is sufficient, simply omit the attribute:
<label for="amount">Amount:</label>
<input id="amount" name="amount" type="number" min="0">
The default step for type="number" is 1, so valid values are whole numbers (0, 1, 2, etc.).
The allowfullscreen attribute on an iframe element is a boolean attribute and should not be assigned a value like "1".
Boolean attributes in HTML don't need a value. Their mere presence on an element means "true," and their absence means "false." When you write allowfullscreen="1", the W3C validator flags it because "1" is not a valid value for a boolean attribute.
According to the HTML specification, a boolean attribute can only have three valid forms: the attribute name alone (allowfullscreen), an empty string (allowfullscreen=""), or the attribute's own name as the value (allowfullscreen="allowfullscreen"). Any other value, including "1", "true", or "yes", is technically invalid.
Invalid Example
<iframe
src="https://www.example.com/video"
allowfullscreen="1">
</iframe>
Valid Example
<iframe
src="https://www.example.com/video"
allowfullscreen>
</iframe>
The aria-setsize attribute tells assistive technologies how many items exist in a set of related elements (such as list items or tree items). It is particularly useful when not all items in a set are present in the DOM — for example, in virtualized lists, paginated results, or lazy-loaded content. According to the WAI-ARIA 1.2 specification:
Authors MUST set the value of
aria-setsizeto an integer equal to the number of items in the set. If the total number of items is unknown, authors SHOULD set the value ofaria-setsizeto-1.
This means -1 is a specifically recommended value for cases where the total count of items is indeterminate. The W3C validator's pattern matching expects only non-negative digits, so it rejects the leading - character. This is a known validator bug and does not reflect an actual problem with your HTML.
Why -1 matters for accessibility
When building interfaces with dynamic or partially loaded content, screen readers need to communicate the size of a set to users. If you have a list of search results but don't know the total count, setting aria-setsize="-1" tells assistive technologies that the set size is unknown. Without this, a screen reader might announce incorrect or misleading information about how many items exist.
What you should do
Do not change your markup to work around this validator error. The value -1 is correct and serves an important accessibility purpose. Removing it or replacing it with an arbitrary positive number would degrade the experience for users of assistive technologies.
Examples
Valid usage that triggers the false positive
This markup is correct but will be flagged by the validator:
<ul>
<li role="option" aria-setsize="-1" aria-posinset="1">Result A</li>
<li role="option" aria-setsize="-1" aria-posinset="2">Result B</li>
<li role="option" aria-setsize="-1" aria-posinset="3">Result C</li>
</ul>
Here, the total number of results is unknown (perhaps they are loaded on demand), so aria-setsize="-1" correctly signals this to assistive technologies.
Known set size (no validator error)
When the total number of items is known, use the actual count. This will not trigger the validator error:
<ul>
<li role="option" aria-setsize="5" aria-posinset="1">Item 1</li>
<li role="option" aria-setsize="5" aria-posinset="2">Item 2</li>
<li role="option" aria-setsize="5" aria-posinset="3">Item 3</li>
</ul>
When aria-setsize is not needed
If all items in the set are present in the DOM, you don't need aria-setsize at all — the browser can compute the set size automatically:
<ul role="listbox">
<li role="option">Apple</li>
<li role="option">Banana</li>
<li role="option">Cherry</li>
</ul>
In summary, if you see this validator error and you're intentionally using aria-setsize="-1" because the total item count is unknown, your code is correct. You can safely ignore this particular warning.
The multiple attribute on the <select> element is a boolean attribute and does not accept a value like "1".
On a <select>, multiple lets the user pick more than one option. Like every boolean attribute in HTML, its meaning comes from whether it is present, not from what you set it to. Writing multiple="1" makes the W3C validator complain because "1" is not one of the values the spec allows.
A boolean attribute can only appear in three forms: the name on its own (multiple), an empty string (multiple=""), or the name repeated as the value (multiple="multiple"). Values such as "1", "true", or "yes" look reasonable but none of them are valid.
Invalid example
<select name="toppings" multiple="1">
<option value="cheese">Cheese</option>
<option value="mushrooms">Mushrooms</option>
<option value="olives">Olives</option>
</select>
Valid example
<select name="toppings" multiple>
<option value="cheese">Cheese</option>
<option value="mushrooms">Mushrooms</option>
<option value="olives">Olives</option>
</select>
Dropping the value and keeping just multiple is the clearest way to write it.
The selected attribute on the <option> element is a boolean attribute and does not accept a value like "1".
Boolean attributes in HTML don't need a value at all. Their mere presence on an element means "true," and their absence means "false." When you write selected="1", the W3C validator flags it because "1" is not a valid value for a boolean attribute.
According to the HTML specification, a boolean attribute can only have three valid forms: the attribute name alone (selected), an empty string (selected=""), or the attribute's own name as the value (selected="selected"). Any other value, including "1", "true", or "yes", is invalid.
Invalid Example
<select name="color">
<option value="red">Red</option>
<option value="blue" selected="1">Blue</option>
<option value="green">Green</option>
</select>
Valid Example
<select name="color">
<option value="red">Red</option>
<option value="blue" selected>Blue</option>
<option value="green">Green</option>
</select>
Using just selected without a value is the cleanest and most common approach.
The HTML specification defines the height attribute on <img> as a "valid non-negative integer," which means it must consist only of digits — no units, no percentage signs. When you write height="100%", the validator expects a digit character but encounters %, producing this error. The same rule applies to the width attribute.
This matters for several reasons. First, browsers use the width and height attributes to reserve the correct amount of space for an image before it loads, which prevents layout shifts (a key performance metric known as Cumulative Layout Shift). When the value contains invalid characters like %, browsers may ignore the attribute entirely or interpret it unpredictably, undermining this layout reservation. Second, invalid HTML can cause inconsistent rendering across different browsers and assistive technologies. Third, the percentage-based sizing you likely intended simply isn't supported through HTML attributes — it requires CSS.
The fix depends on what you're trying to achieve:
- Fixed dimensions: Replace the percentage with a plain integer representing the image's intrinsic or desired pixel size (e.g.,
height="300"). - Responsive or percentage-based sizing: Remove the
heightattribute (or set it to the image's intrinsic pixel dimensions) and use CSS to control how the image scales within its container.
It's a good practice to always include both width and height attributes with the image's actual intrinsic dimensions, then use CSS to override the display size. This gives browsers the aspect ratio information they need to reserve space while still allowing flexible layouts.
Examples
Incorrect: percentage value in the height attribute
This triggers the validation error because % is not a valid digit:
<img src="photo.jpg" width="100%" height="100%" alt="A landscape photo">
Fixed: using integer pixel values
Specify the image's intrinsic dimensions as plain numbers:
<img src="photo.jpg" width="800" height="600" alt="A landscape photo">
Fixed: combining HTML attributes with CSS for responsive sizing
Set the intrinsic dimensions in HTML for layout stability, then use CSS to make the image responsive:
<style>
.responsive-img {
width: 100%;
height: auto;
}
</style>
<img
src="photo.jpg"
width="800"
height="600"
class="responsive-img"
alt="A landscape photo">
With this approach, the browser knows the image's aspect ratio (800×600) and reserves the appropriate space, while CSS ensures the image scales fluidly to fill its container. The height: auto rule maintains the correct aspect ratio as the width changes.
Fixed: filling a container with CSS only
If you don't know the image's intrinsic dimensions and simply want it to fill a container, you can omit the HTML attributes and rely entirely on CSS:
<style>
.image-container {
width: 300px;
height: 200px;
}
.image-container img {
width: 100%;
height: 100%;
object-fit: cover;
}
</style>
<div class="image-container">
<img src="photo.jpg" alt="A landscape photo">
</div>
The object-fit: cover property ensures the image fills the container without distortion, cropping as needed. Note that omitting width and height attributes means the browser cannot reserve space before the image loads, so this approach may cause layout shifts. Where possible, prefer including the intrinsic dimensions as shown in the previous example.
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