<body>: The BODY Element
Last updated: 2026-10-13
<body>The BODY Element
The document body holding everything users see: text, images, forms and more.
| Category | Document Structure |
|---|---|
| Content Model | Child of the root element |
| Allowed Parents | Any element that accepts flow content |
| Content Tag | Yes — requires closing </body> tag |
| Status | Standard |
📝 Syntax
<body>
<h1>Visible content</h1>
</body>
▶ Example
Edit the code below and see the live result in the playground:
🌐 Browser Support
| Browser | |||||
|---|---|---|---|---|---|
| <body> | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported in all major browsers | |||||
Tip: body holds all visible content; modern layout uses semantic tags like header/main/footer inside it.
❓ FAQ
QWhich common events can be handled on body?
APage-level events mostly dispatch to body/window:
load (all resources done), scroll, resize (really on window), and click delegation bubbling to body. Modern advice: attach global listeners to window; body mainly plays the DOM structure root.QHow do I remove the default margin on body?
ABrowsers give body an 8px margin by default. Reset with
body { margin: 0; } or a modern reset (* { margin: 0; } plus box-sizing). It is practically the first line of CSS in every project.QDoes body only hold visible content?
Abody's content model is flow content, so non-visible elements like
<script>, <template>, and <noscript> are legal. But <meta> and <title> are not — those belong exclusively to head.🏷️ Related Tags
💡 Related Cases
More case studies coming soon — check back later.