Menu
Document Structure & Metadata

<html> Root Element

The container for the entire document.

1The Root

The <html> tag wraps every other element. Always set the lang attribute so screen readers and search engines know the language.

Example Code
css
<!DOCTYPE html>
<html lang="en">
  <head>...</head>
  <body>...</body>
</html>

2Put the element in context

The root html element contains the document’s head and body. Its language attribute helps assistive technology and other tools interpret the main text. A fragment copied into a component does not need another root html element, but a standalone downloaded page does.

3Practice with a small page

Build a full standalone page with a suitable lang value. Inspect the document tree and locate the head and body. Mark a phrase in another language separately rather than changing the entire page language for a single sentence.

Finished reading?

Mark this topic as complete to track progress.