**`<body>`** is the second (and last) child of `<html>`, right after `<head>`, and it holds everything rendered on the page: headings, paragraphs, images, forms, and interactive elements. There is exactly one `<body>` per document. Global event handlers like `onload` are sometimes attached to `<body>`, though modern code prefers `addEventListener` in a script.
1Understanding <body>
`<body>` is the second (and last) child of <html>, right after <head>, and it holds everything rendered on the page: headings, paragraphs, images, forms, and interactive elements. There is exactly one <body> per document. Global event handlers like onload are sometimes attached to <body>, though modern code prefers addEventListener in a script.
CSS resets often target <body> directly (e.g. margin: 0) because browsers apply a small default margin to it that causes unexpected gaps at the edges of the page.
<body>
<header><h1>My Blog</h1></header>
<main>
<p>Welcome to my blog.</p>
</main>
<footer>© 2026</footer>
</body>2Practical Example
Here is a real-world application of <body> showing how it is used in production HTML.
<!-- Scripts placed at the end of body run after content is parsed -->
<body>
<p>Content loads first...</p>
<script src="/app.js"></script>
</body>3Best Practices
Follow these guidelines when working with <body>:
1. Keep <body> to actual visible/interactive content — metadata belongs in <head>
2. Structure content with semantic elements (<header>, <main>, <footer>) inside <body> instead of only <div>s
3. Load your main JavaScript bundle right before the closing </body> tag (or use defer) so it doesn't block rendering
Tip: CSS resets often target <body> directly (e.g. margin: 0) because browsers apply a small default margin to it that causes unexpected gaps at the edges of the page.
<body>
<header><h1>My Blog</h1></header>
<main>
<p>Welcome to my blog.</p>
</main>
<footer>© 2026</footer>
</body>