HTML5 <html> Tag

The HTML <html> tag is used to represent the root (top-level element) of an HTML document. For this reason, it is also referred to as the root element. All other elements must be descendants of this element.

The only content permitted inside this element is one <head> element, followed by one <body> element. The start tag for this element may be omitted if the first thing inside the <html> element is not a comment. You can omit the end tag if the <html> element is not immediately followed by a comment, and it contains a <body> element either that is not empty or whose start tag is present.

The following style is applied to this element by default:

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

Here is an example of using this tag:

<!DOCTYPE html>
<html lang="en">
    <title>Swapping Songs</title>
    <h1>Swapping Songs</h1>
    <p>Tonight I swapped some of the songs I wrote with some friends, who gave me some of the songs they wrote. I love sharing my music.</p>



This attribute specifies the XML Namespace of the document. Its default value is <a href=""></a>. This attribute is required in documents parsed with XML parsers, and optional in text/html documents.

Further Reading

  1. Read more about the HTML <html> element on MDN.
  2. You can also read the HTML <html> tag reference on W3C.

Reader Comments

1. You can register or login to post a comment. Asking readers to register improves the quality of discussion.

2. As a registered user, you will also get to access features like choosing between a light and dark theme or anything else that we might implement in future.

Follow Us For Updates

Go To Top