Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

The body element — document contents

The `body` element represents an HTML document’s contents. A conforming document contains only one such element.

Version: WHATWG HTML Living Standard; index snapshot date recorded separately

Syntax

<body>…</body>

body is the second child element of html, after head. Its content model is flow content: it can contain headings and paragraphs, among other elements. It supports global attributes.

In text/html, tags may be omitted only under specific conditions. The example writes both explicitly to keep the structure clear.

Its DOM interface is HTMLBodyElement; scripts access it through document.body. Some event-handler attributes, such as onload, target Window, not the element itself. The example places a heading and paragraph inside body.

Examples

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Body example</title>
</head>
<body>
  <h1>Hello</h1>
  <p>This is the document content.</p>
</body>
</html>

Result

Hello
This is the document content.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources