HTML <html> Tag

Our topic in this post is Tag HTML examples. In hopes that it would provide learners with what they need to learn.

The HTML <html> tag is used to define the root element of an HTML document. It is the first tag in an HTML document and contains all the other HTML elements on the page.

Here is a basic HTML document:

Example

<!DOCTYPE html> <html lang="en"> <head> <title>Here goes your HTML Document Title</title> </head> <body> <h1>Heading to be written here</h1> <p>Write the content about the heading in this paragraph</p> </body> </html>

Here is complete example of the <html> tag:

Example: 

<!DOCTYPE html> <html lang="en" class="no-js"> <head> <title>Mr Examples</title> </head> <body> <header> <h1>Mr Examples</h1> </header> <main> <h2>Welcome to Mr Examples</h2> <p>This is the content of Mr Examples.</p> </main> </body> </html>


HTML <html> Tag Importance

The <html> tag is of utmost importance in HTML because it is the root element of an HTML document and is used to define the basic structure of the document. Here are some reasons why the <html> tag is important:

  • The <html> tag is used to define the document type and version using a document type declaration (DTD). This tells web browsers and other software how to interpret the content of the document.
  • The <html> tag provides the structure for the entire document and contains all the other HTML elements on the page. The <html> tag is always the first tag in an HTML document and serves as the root element for the document.
  • The <html> tag can include the lang attribute, which specifies the language of the document. This is important for accessibility, as it helps screen readers and other assistive technologies to correctly pronounce and interpret the text on the page.
  • The <html> tag can include other attributes such as the title and meta tags that are important for search engine optimization. The title tag is used to define the title of the document, while the meta tag provides information about the document such as keywords, descriptions, and author information.
  • The <html> tag can include the lang attribute, which supports internationalization by allowing web developers to specify the language of the document. This is important for making sure that the content on the page is properly translated and localized for different audiences.

Tag HTML Usage

The Tag HTML <html> identifies the starting point of an HTML document.

The <html> tag is the umbrella tag that covers all HTML elements (except for the <!DOCTYPE> tag).

IMPORTANT: Ensure that you always add the lang attribute inside the html tag, to indicate the language of the Web page. The purpose of this is to facilitate search engines and browsers.

Attributes

AttributeValueOverview
xmlnsIndicate the XML namespace attribute(if you want to conform your content to XHTML)

Browser Compatibility

Element
<html>YesYesYesYesYes

Attributes

Global

The <html> tag is also compatible with Global Attributes in HTML.


Predefined CSS

Generally, many browsers present the <html> element with these default values:

html {
display: block;
}
html:focus {
outline: none;
}
If you found this article informative, then do share this meaningful information with your friends by clicking on the links below.
We value your feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!
icon

Leave a Reply

Your email address will not be published. Required fields are marked *