CSS Portal

HTML <html> Tag

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The <html> element represents the root of an HTML document. It serves as the container for all other elements on the page, including the <head> and <body> sections. Essentially, it defines the start and end of an HTML document, providing the structure that browsers rely on to interpret and render the content correctly.

Every HTML document begins with an <html> tag and ends with a closing </html> tag. The <head> element, which contains metadata, links to stylesheets, scripts, and other resources, is nested directly inside <html>. Following the <head>, the <body> element contains the actual content displayed to users, such as text, images, links, tables, and interactive elements.

The <html> tag also plays a crucial role in defining the document’s language and directionality through attributes like lang and dir (even though you asked not to cover attributes in detail, it’s worth noting that these are often set on the <html> element to ensure accessibility and proper rendering). By wrapping the entire document, the <html> element establishes the context for the browser’s parsing engine and helps maintain the hierarchical structure that HTML relies on.

In modern web development, the <html> element is foundational. All CSS selectors, JavaScript manipulations, and DOM operations ultimately depend on the proper structure initiated by <html>. It is indispensable for ensuring that content is well-structured, accessible, and semantically meaningful.

Properties

Permitted Parents
None. This is the root element of a document.
Content
<head> and <body>
Start/End Tags
Start tag: optional, End tag: optional

Example

<html>
<head>
<title>Title of the document</title>
</head>
<body>
The content of the document......
</body>
</html>

Attributes

version
Specifies the HTML DTD version of the document. The version attribute is deprecated - use the <!DOCTYPE> tag instead.

Global Attributes

The <html> tag also supports the Global Attributes in HTML5

Event Attributes

The <html> tag also supports the Event Attributes in HTML5

Browser Support

The following information will show you the current browser support for the HTML <html> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.

This tag is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 26th December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!