<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.

CategoryDocument Structure
Content ModelChild of the root element
Allowed ParentsAny element that accepts flow content
Content TagYes — requires closing </body> tag
StatusStandard

📝 Syntax

<body>
  <h1>Visible content</h1>
</body>

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
<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.
More case studies coming soon — check back later.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏