You might see <body> Element reference while reading someone else’s HTML, or need it while building a page of your own. Instead of memorizing a definition, look at a working example and see when the element makes sense.
The Idea in Plain English
Contains the document content intended for display, such as headings, paragraphs, navigation and images.
For a reference page, pay attention to where the element is allowed, whether it needs a closing tag, and what other elements it can contain.
A Working Example
Read the sample once before copying it. Notice the element names and attribute values, then compare them with the explanation below.
<!DOCTYPE html>
<html lang="en">
<head><meta charset="utf-8"><title>Starter</title></head>
<body>
<h1>Hello, world!</h1>
<p>This is the page people see.</p>
</body>
</html>
What Each Part Does
- The body contains the material a visitor normally sees.
- The meta element supplies machine-readable settings; its name or charset decides which setting.
- The title gives the document a name in tabs and other browser surfaces.
- lang identifies the natural language for text-to-speech and language tools.
- charset identifies the character encoding used by the document.
The heading and paragraph appear on the page.
Try It Yourself
Try replacing the example content with your own while keeping the valid HTML structure.
Common Beginner Mistakes
- Putting title or charset metadata inside body.
- Changing several parts of the example at once, making it difficult to see which part caused a different result.
- Choosing a tag only because its default appearance looks right, without checking whether it describes the content correctly.
Key Takeaways
- Contains the document content intended for display, such as headings, paragraphs, navigation and images.
- The heading and paragraph appear on the page.
- Test the markup in a browser, and check accessibility and real-world behavior where relevant.