HTML Document Structure
What Is It?
An HTML page has two main parts: head for page information and body for visible content.
What the Tags Mean
html: wraps the page.head: contains the title and other information.title: names the browser tab.body: contains headings, text, and images.
Example 1
Save each example as index.html and open it in your browser. Each code block is a complete page.
<!DOCTYPE html>
<html lang="en">
<head>
<title>My notes</title>
</head>
<body>
<h1>Shopping list</h1>
<p>Buy paper and pencils.</p>
</body>
</html>Browser preview
What you see: My notes appears in the tab. Shopping list appears on the page.
Example 2: Another Use
Open this second complete page and check its browser tab. Its title is different from the visible heading.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Saturday shopping</title>
</head>
<body>
<h1>My example page</h1>
<p>Look at the browser tab to check the title or icon. Meta tags describe the page without adding visible text.</p>
</body>
</html>Browser preview
Simple Tip
Put visible text in body, not head.
Try It Yourself
Give the tab one name and the heading another.