HTML <html> Tag

Represents the root of an HTML document

The <html> tag is the root element of an HTML document. It acts as a container for all other HTML elements (except for <!DOCTYPE>). Every other HTML eleement is a descendant of this root element.

Element Type Block
Self Closing False
Positioning Root (wraps all other elements)

Syntax

The basic syntax of this html element is

<html> </html>

Code Example

This is how you use the <html> tag in the document.

Example
<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>An HTML Document</title>
    </head>
    <body>
        <h1>This is an HTML Document</h1>
        <p>This is a simple paragraph with a <a href="#">link</a></p>
    </body>
</html>

Tag-Specific Attributes

List of attributes that are specific to the <html> tag.

Attribute Value(s) Description
manifest URI Deprecated Specifies the URI of the document's cache manifest, earlier used for caching. HTML 5 now already has in-built support for application cache so manifest attribute is now deprecated.
version DTD Deprecated This specifies the version of the HTML Document Type Definintion that governs the current document. This prevents the browser from switching to different rendering modes as in earlier times, websites had html code specific to a browser and in order to continue supporting older sites the attribute was used, it is no longer needed as there already is a Doctype declration.
xmlns http://www.w3.org/1999/xhtml Used to define an XML namespace for the HTML document. It was required in XHTML, and optional in tex/html documents.

Global Attributes

The <html> tag well supports all the global attributes in HTML5.




Events Attributes

The <html> tag also supports all the global events attributes in HTML5 as well.




Accessibility Guidelines

The <html> tag is commonly used with the global lang="" attribute as you can see in the example above. This helps screen readers and other assistive technologies figure out the language without depending on the operating system defaults.


Browser Support

The <html> tag is well supported in majority of browsers.

HTML Element Chrome Firefox Edge Safari Opera Internet Explorer
<html> 1+ 1+ 12+ 1+ 2.1+ 2+