The HTML <html> tag

Definition and Usage

<html> tag represents the root of the HTML document (root element), indicating the start of the HTML section in the document.

<html> tag is the container for all other HTML elements (except <!DOCTYPE> tag).

This element can inform the browser that it is an HTML document.

<html> With </html> The tag limits the start and end points of the document, between which are the document header and body. As you know, the document header is by <head> The tag defines, while the main content is defined by <body> Definition of tag.

Note:You should always be in <html> Tags containing the lang attribute declare the language of the web page. This is intended to help search engines and browsers.

See also:

HTML Tutorial:HTML Introduction

HTML DOM Reference Manual:HTML Object

Further reading: Detailed explanation of HTML xmlns attribute

Example

A simple HTML document:

<!DOCTYPE html>
<html lang="zh">
<head>
  <title>Title of the document</title>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>

Try It Yourself

Attribute

Attribute Value Description
xmlns http://www.w3.org/1999/xhtml Specifies the XML namespace attribute (if you need your content to be compliant with XHTML).

Global Attributes

<html> The tag also supports Global Attributes in HTML.

Default CSS Settings

Most browsers will use the following default values to display <html> Element:

html {
  display: block;
}
html:focus {
  outline: none;
}

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support