Encodera

Thanks for reading!

Donate to the site — we work hard for you.

HTML & CSS reference

<body>

The visible part of the page: everything the user sees.

Syntax

<body>…</body>

Examples

Page content and styles for body:

<style>
  body { background: #fdf6e3; font-family: Georgia, serif; }
</style>
 
<h1>Welcome</h1>
<p>Text, images and forms all live in body.</p>

Notes

By default <body> has an 8px margin — that is why CSS resets often include body { margin: 0; }. A page has exactly one <body>.

See also

  • <html> — The root element of the page: `<head>` and `<body>` live inside it.
  • <head> — The service part of the page: encoding, tab title, linked styles and scripts.
  • <main> — The main content of the page — what the user came for.

Related recipes

In the tutorial

  • Document structure — The skeleton of an HTML page — doctype, html, head and body, the encoding, the tab title, viewport and your first index.html file.

Thanks for reading!

Donate to the site — we work hard for you.