MyInternships.in

HTML Tags

HTML <html> Tag

The <html> tag is the root element that wraps all other elements on the page and represents the whole document. Everything except the doctype lives inside it.


The <html> Tag

The <html> element is the top-level element of an HTML document, often called the root element. Every other element must be a descendant of it. A document contains exactly one <html> element, which itself contains one <head> followed by one <body>.

It has no visible rendering of its own, but the lang attribute you set on it is used by search engines, screen readers, and translation tools to identify the page's language.

Syntax

The root element wraps the head and body.
Example
<html lang="en">
  <head> ... </head>
  <body> ... </body>
</html>

Example

A complete document with the lang attribute set.
Example
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Language Example</title>
  </head>
  <body>
    <h1>Bonjour et Hello</h1>
    <p>This page declares English as its language.</p>
  </body>
</html>

More Examples

Declaring French with lang="fr" helps translation tools.
Example
<!DOCTYPE html>
<html lang="fr">
  <head>
    <title>Exemple</title>
  </head>
  <body>
    <h1>Bienvenue</h1>
    <p>Cette page est en francais.</p>
  </body>
</html>

Attributes

AttributeDescription
langDeclares the primary language of the document (for example en, fr, hi).
dirSets base text direction: ltr, rtl, or auto.
xmlnsThe XML namespace, used mainly when serving XHTML.
💡

Always set a lang attribute. It improves accessibility for screen readers and helps search engines and browsers offer correct translations.

Key Takeaways

  • <html> is the single root element of every page.
  • It contains exactly one <head> and one <body>.
  • The lang attribute declares the document language.
  • It has no visual output of its own.
  • The dir attribute controls left-to-right or right-to-left text.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships