version was an attribute on the <html> root. It claimed which HTML DTD version governed the document. That information already lived in the document type declaration, so the attribute was always redundant.
The HTML Standard lists version on html as obsolete: unnecessary — omit it. Use <!DOCTYPE html> plus lang on the root instead.
Deprecated / obsolete.
Do not put version on <html>. Learn it only to recognize old markup and migrate to a modern DOCTYPE.
Syntax
HTML Syntax
syntax.html
<!-- obsolete --> <html version="…">
Modern form:<!DOCTYPE html> then <html lang="en"> — no version attribute.
Values
Attribute Values
Historical strings (study only). None are required today:
Compare obsolete version markup with a modern HTML5 skeleton. Prefer the modern snippet.
markup style
Study only — version on html is obsolete; use <!DOCTYPE html>.
Snippet
<!-- obsolete — do not use -->
<html version="-//W3C//DTD HTML 4.01//EN">
…
</html>
Obsolete version attribute — redundant with the DOCTYPE; omit it.
Code
HTML Examples
Study snippets. Use Try It Yourself for a live editor. Prefer modern patterns in production.
Example 1 — Recognize Obsolete Markup
Old pages sometimes put a DTD-like string on <html>. Do not copy this.
HTML
<!-- Obsolete — for study only -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html version="-//W3C//DTD HTML 4.01//EN">
<head>
<title>Legacy root</title>
</head>
<body>
<p>The version attribute adds nothing useful here.</p>
</body>
</html>
<!DOCTYPE html> — triggers standards mode in browsers.
Omit version — the living standard says it is unnecessary.
charset + viewport — practical head basics for every page.
One root — a single <html> wrapping head and body.
Example 3 — Useful Root Attributes Instead
Prefer lang (and, in XML-serialized XHTML, xmlns) — not version.
HTML
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Language on the root</title>
</head>
<body>
<p>lang helps accessibility, search, and hyphenation — version does not.</p>
</body>
</html>
Screen readers & SEO — benefit from a correct language tag.
xmlns — only needed for XML/XHTML parsing, not for everyday HTML5.
Skip obsolete root flags — including version and the old manifest attribute.
Edge Cases & Pitfalls
Most confusion is treating version as a live HTML5 switch or reading it from JavaScript.
obsolete
Authors must not use it
WHATWG: version on html is obsolete — omit it. Spec replacement: nothing; use the DOCTYPE.
DOCTYPE
DOCTYPE controls standards mode
Missing or quirky DOCTYPEs affect layout quirks. A version attribute does not fix that — put <!DOCTYPE html> first.
IDL
HTMLHtmlElement.version
Deprecated DOM property; often returns an empty string. Do not depend on it for feature detection.
naming
Not a software version
This attribute is not package.json, API, or HTTP versioning. It was only a DTD label on the root.
migrate
Search and delete
Strip version="…" from legacy roots; keep or add lang and a modern DOCTYPE.
Compatibility
Browser Support
version is an obsolete HTML attribute on <html>. Authors must not use it; engines do not need it for parsing.
✓ Obsolete · Do not use
version
Harmless if present, but non-conforming. Prefer and lang on the root. Do not read HTMLHtmlElement.version for real version data.
0%Author use (do not)
Google ChromeIgnored for authors
Do not use
Mozilla FirefoxIDL empty / ignore
Do not use
Apple SafariIgnored for authors
Do not use
Microsoft EdgeIgnored for authors
Do not use
OperaIgnored for authors
Do not use
Samsung InternetIgnored for authors
Do not use
Internet ExplorerHistorical
Do not use
versionObsolete
Bottom line: Study only. Delete version from legacy
tags; use and lang instead.
Remember
Key Takeaways
Status: obsolete — authors must not use it.
Old idea: label the HTML DTD on the root (redundant).
Replace with:<!DOCTYPE html>.
Prefer on root:lang (not version).
One line:version on <html> was a redundant DTD label — omit it and start pages with <!DOCTYPE html>.
Frequently Asked Questions
An attribute on the <html> root that claimed which HTML DTD version governed the document. It was redundant with the document type declaration and is obsolete.
No. The WHATWG HTML Standard lists version on html as obsolete: Unnecessary. Omit it altogether. Use <!DOCTYPE html> and a modern <html lang="…"> root.
Start every page with <!DOCTYPE html>. That switches the browser into standards mode. You do not put a version number on the html element.
The legacy HTMLHtmlElement.version IDL property is deprecated. In practice it is empty or useless — do not read version information from it.
No. This page is only about the obsolete HTML attribute on <html>. Software versioning is unrelated.
Deprecated / obsolete — not experimental. Study it only to recognize old markup.