HTML version Attribute

The obsolete HTML version attribute was historically used on the <html> element to identify the version of HTML used by a document.

Historical Syntax

The version attribute was placed on the opening <html> element and contained information identifying an HTML document type definition.

<html version="-//W3C//DTD HTML 4.01//EN">

The value identified the HTML version or document type associated with the document.

Historical Elements

The obsolete version attribute was associated with the <html> element.

Element Historical Purpose
<html> Provided version information associated with the HTML document.

Historical Use

Earlier versions of HTML were defined using formal document type definitions, commonly called DTDs. The version attribute could identify the document type information associated with the HTML document.

<!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">
  ...
</html>

The document type declaration already supplied the information needed to identify the document type, making a separate version attribute unnecessary.

Why It Became Obsolete

The version attribute duplicated information that could be provided by the document type declaration and was not needed for processing modern HTML documents.

Current HTML is maintained as a Living Standard rather than as a series of numbered HTML versions that authors identify with a version attribute.

Modern Alternative

Remove the obsolete version attribute. A modern HTML document begins with the short HTML doctype followed by the <html> element.

Historical HTML

<html version="-//W3C//DTD HTML 4.01//EN">

Modern HTML

<!doctype html>
<html lang="en">

The <!doctype html> declaration tells browsers to process the document in standards mode. It does not contain a version number and should appear before the <html> element.

The current lang attribute shown on the <html> element identifies the language of the document's content. It is unrelated to the obsolete version attribute.

Legacy Browser Support

The version attribute appeared in older HTML specifications and may still be encountered in legacy documents.

Modern webpages should not use the attribute. Remove it when updating older markup and use the standard <!doctype html> declaration at the beginning of current HTML documents.

For additional information about historical browser compatibility, visit Can I Use? . Search for the HTML element or attribute you want to check. Search results can include related HTML features, element attributes, APIs, and other technologies, so select the result that most closely matches the legacy feature you are researching.

A current attribute associated with the <html> element and an obsolete document-level attribute include:

  • lang - Identifies the language of the document or an element's content.
  • manifest - An obsolete attribute historically used on <html> to reference an Application Cache manifest.

Specifications

The version attribute on the <html> element is obsolete and must not be used by authors. Modern HTML documents use the HTML doctype and do not declare an HTML version with this attribute. See the WHATWG HTML Living Standard for information about obsolete and non-conforming features.