Encodera

Thanks for reading!

Donate to the site — we work hard for you.

HTML & CSS reference

<html>

The root element of the page: `<head>` and `<body>` live inside it.

Syntax

<html lang="en">…</html>

Attributes

ParameterTypeDescription
langlanguage codeThe language of the page: `en`, `ru`, `de`…

Examples

A page skeleton with a language:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>About us</title>
  </head>
  <body>
    <p>Everything visible goes into body.</p>
  </body>
</html>

Notes

Always set lang: the browser uses it for hyphenation rules, and screen readers for pronunciation. In CSS you reach this element with the html or :root selector — the usual place for the base font size and CSS variables.

See also

  • <!DOCTYPE> — The document type declaration: tells the browser the page is written in modern HTML.
  • <head> — The service part of the page: encoding, tab title, linked styles and scripts.
  • <body> — The visible part of the page: everything the user sees.
  • lang — The language of an element's content.

Related recipes

In the tutorial

  • Document structure — The skeleton of an HTML page — doctype, html, head and body, the encoding, the tab title, viewport and your first index.html file.

Thanks for reading!

Donate to the site — we work hard for you.