HTML html Tag
HTML html Tag
The HTML <html> tag is the first element that comes after the <!doctype> element on a webpage. All the other HTML tags come inside the opening and closing <html> tag.
- It is also known as the root element/main element that needs to be present in all HTML documents or webpages.
- All other elements like
<head>,<title>,<body>,<p>,<audio>,<img>and many more need to be specified inside the opening and closing<html>tag. - This element allows the browser to identify the document type.
HTML <html> Tag - Syntax and Usage
The <html> tag requires the start(opening) tag and end(closing) tag. The required syntax for it is:
<html>
<!-- entire HTML document comes here -->
</html>HTML <html> Tag Basic Example
Below we have a basic example for a clear understanding of <html> tag:
<!doctype html>
<html>
<head>
<title>
example of using html tag
</title>
</head>
<body>
<div>This is an HTML document</div>
<p>This is our first paragraph</p>
<h1>This is our first heading</h1>
<h2>This is second heading</h2>
</body>
</html>As you can see in the example above, the <html> tag is the tag in which all other HTML tags are added.
HTML <html> Tag Attributes
This element does not have any specific attributes although this element supports Global attributes and Event attributes.
| Attributes | Description | Value |
manifest | This attribute defines a URL containing the cache information of the document | URL(Universal Resource Locator) |
spellcheck | This attribute is used to define whether an element should be checked for spelling and grammar or not | true, false |
contenteditable | This attribute specifies whether or not you can edit the content | true, false |
context-menu | This attribute specifies the context menu for an element | menu-id |
draggable | This element specifies whether or not you can drag an element | true, false, auto |
Default CSS Settings for <html> Tag
html {
display: block;
}
html:focus {
outline: none;
}Browser Support for <html> Tag
Following browsers support this attribute:
- Firefox 1+
- Google Chrome 1+
- Internet Explorer 2+
- Apple Safari 1+
- Opera 2.1+










