# The “version” attribute on the “html” element is obsolete. You can safely omit it.

> Canonical HTML version: https://rocketvalidator.com/html-validation/the-version-attribute-on-the-html-element-is-obsolete-you-can-safely-omit-it
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

In earlier versions of HTML, the `version` attribute on the `<html>` element served as a way to indicate the DTD (Document Type Definition) the document followed. For example, you might have seen something like `<html version="-//W3C//DTD HTML 4.01//EN">`. This was largely redundant even then, because the `<!DOCTYPE>` declaration at the top of the document already communicated the same information to browsers and validators.

With the introduction of HTML5, the `version` attribute was officially marked as obsolete. The HTML Living Standard maintained by WHATWG does not define or support it. Modern browsers completely ignore it, so it has no functional effect on rendering or behavior. However, keeping it in your markup produces a validation warning from the W3C HTML Validator and adds unnecessary clutter to your code.

Removing this attribute has no side effects. The `<!DOCTYPE html>` declaration is the only mechanism needed to signal that your document uses the current HTML standard. Keeping your markup clean and free of obsolete attributes improves maintainability and ensures your documents pass validation without unnecessary warnings.

## How to fix it

1. Locate the `<html>` tag in your document.
2. Remove the `version` attribute and its value entirely.
3. Ensure you have a valid `<!DOCTYPE html>` declaration at the top of the document.
4. Keep the `lang` attribute on the `<html>` element, as it is important for accessibility and internationalization.

## Examples

### Incorrect: using the obsolete `version` attribute

```html
<!DOCTYPE html>
<html version="-//W3C//DTD HTML 4.01//EN" lang="en">
  <head>
    <title>My Page</title>
  </head>
  <body>
    <p>Hello, world!</p>
  </body>
</html>
```

This triggers the W3C validator warning: *The "version" attribute on the "html" element is obsolete.*

### Correct: `version` attribute removed

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>My Page</title>
  </head>
  <body>
    <p>Hello, world!</p>
  </body>
</html>
```

The `version` attribute has been removed, and the document remains fully valid. The `<!DOCTYPE html>` declaration and the `lang` attribute are the only things needed on the `<html>` element for a well-formed, standards-compliant document.
