Advertisement

HTML <body> tag

Examples

A simple HTML document with the most basic essential elements:

<html>

<head>
  <title>文档的标题</title>
</head>

<body>
  文档的内容... ...
</body>

</html>

Try it yourself

Browser Support

IE Firefox Chrome Safari Opera

All major browsers support the <body> tag.

Definition and Usage

The main body element defines the documents.

body element contains all the contents of the document (such as text, hyperlinks, images, tables and lists, etc.)

Differences between HTML and XHTML

In HTML 4.01, the "presentation attribute" all body elements are not in favor of use.

In XHTML 1.0 Strict DTD, the "presentation attribute" all body elements not supported.

Optional attributes

Attributes value description
alink
  • rgb (x, x, x)
  • #xxxxxx
  • colorname

Deprecated. Use styles instead.

The provisions of the document an active link (active link) of color.

background URL

Deprecated. Use styles instead.

Provisions of the background image of the document.

bgcolor
  • rgb (x, x, x)
  • #xxxxxx
  • colorname

Deprecated. Use styles instead.

Predetermined background color of the document.

link
  • rgb (x, x, x)
  • #xxxxxx
  • colorname

Deprecated. Use styles instead.

Provisions of unvisited links in the document default color.

text
  • rgb (x, x, x)
  • #xxxxxx
  • colorname

Deprecated. Use styles instead.

The color of all the provisions of the document text.

vlink
  • rgb (x, x, x)
  • #xxxxxx
  • colorname

Deprecated. Use styles instead.

The provisions of the document has been visited link color.

Global Properties

<body> tag supports HTML in the global properties .

Event Properties

<body> tag supports HTML in the event properties .

Examples TIY

A simple HTML file
This example is a very simple HTML document, use as little HTML tags. It shows you the contents of the body element is how the browser displays.
background color
This example demonstrates how to add a background color for the HTML page.
Background picture
This example demonstrates how to add a background image to an HTML page.

Related Pages

HTML DOM Reference Manual: the Column Object