KodingKaro
HTML · Beginner · HTML Document Structure

Head, metadata, title, and body

The head and body separate information about a document from the content people read on the page.

✓ What you will learn in this topic

  • Explain the purpose of Head, metadata, title, and body in a real HTML document.
  • Choose and apply the elements shown in both examples.
  • Recognize the specific mistake described in this lesson.

Concept explanation

The head contains metadata, the browser-tab title, and links to resources. A charset declaration helps decode text, and the viewport declaration makes the layout use the device width on mobile. The body contains the page’s visible content. The title is different from the h1: the title names the document in tabs, bookmarks, and search contexts, while the h1 is the main heading shown in the page.

Syntax

Put charset early in head, include viewport and a unique title, then place rendered content in body.

Example 1: a small page

The meta elements describe document settings; the title is not the visible page heading.

<head>
  <meta charset=\"utf-8\">
  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
  <title>My reading list</title>
</head>
<body><h1>Books to explore</h1></body>

Expected result: The tab is titled My reading list and the page shows Books to explore.

Example 2: a practical page

The title and description summarize the page for external contexts; the main heading introduces its visible content.

<head>
  <meta charset=\"utf-8\">
  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
  <title>Visit | River Museum</title>
  <meta name=\"description\" content=\"Plan a visit to the River Museum.\">
</head>
<body><main><h1>Plan your visit</h1></main></body>

Expected result: The browser shows Plan your visit as the heading and uses Visit | River Museum as the document title.

Common mistakes

Visible page content belongs in body; metadata such as the title and character encoding belongs in head.

Best practices

Use the HTML doctype, set the document language, declare UTF-8, include the mobile viewport, and write a useful title.

Practice exercise

Create a complete HTML file for a local book club. Give it a language, a descriptive browser-tab title, and one visible heading and paragraph.

Lesson summary

  • Head is for metadata and resources; body is for rendered page content.
  • Use the HTML doctype, set the document language, declare UTF-8, include the mobile viewport, and write a useful title.

Knowledge check

Which element supplies the browser-tab title?

Show the explanation

The title element in head provides the document title; an h1 supplies the main visible heading.

Practical example

html
<head>
  <meta charset=\"utf-8\">
  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
  <title>My reading list</title>
</head>
<body><h1>Books to explore</h1></body>

Expected result:

The tab is titled My reading list and the page shows Books to explore.

Hands-on practice task

Create a complete HTML file for a local book club. Give it a language, a descriptive browser-tab title, and one visible heading and paragraph.

In this section

Other lessons in HTML Document Structure

Broaden your knowledge

Related learning topics