The <body> contains everything visible on the page — text, images, forms, everything a visitor actually sees and interacts with.
Example
<body>
<header>
<h1>CodingNow</h1>
<nav>...</nav>
</header>
<main>
<section>
<h2>Our Courses</h2>
<p>AI, Data Science, and Full Stack programs.</p>
</section>
</main>
<footer>
<p>© 2026 CodingNow</p>
</footer>
</body>
Only One Body Per Document
A valid HTML document has exactly one <body> element — everything visible lives inside it. Multiple <body> tags are invalid; browsers will typically merge their content into the first one, which isn't behavior you should rely on.
Where JavaScript Often Goes
Script tags for page behavior are commonly placed just before the closing </body> tag, so the HTML content loads and renders before the script runs:
<body>
...page content...
<script src="/app.js"></script>
</body>
Modern practice often uses defer in the <head> instead — see defer — but placing scripts at the end of <body> remains a valid, simple approach.
Common Mistakes
- Adding a second
<body>tag by accident when copy-pasting a full page's markup into an existing page - Putting
<meta>or<title>tags inside<body>instead of<head>— invalid placement, even though some browsers tolerate it
Interview Relevance
Usually tested indirectly, as part of "write a complete HTML document" exercises — knowing exactly what belongs in <head> versus <body> is the practical skill being checked.
Practice Question
Write the <body> for a simple product page with a heading, a product description paragraph, and a "Buy Now" button.