HTML <body> Tag

Topic: HTML Tag ReferencePrev|Next


The <body> element represents the main content of the document. It typically wraps around all of the content that will be displayed on screen, such as headings, paragraphs, hyperlinks, images, forms, tables, lists, videos and so on.

The following table summarizes the usages context and the version history of this tag.

Parent: <html>
Placement: Block
Content: Block, inline, and text
Start/End Tag: Start tag: optional, End tag: optional
Version: HTML 2, 3.2, 4, 4.01, 5


The basic syntax of the <body> tag is given with:

HTML / XHTML: <body> ... </body>

The example below shows the <body> tag in action.

<!DOCTYPE html>
    <title>HTML Document</title>
    <p>Hello World!</p>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <body> tag.

Attribute Value Description
alink color Obsolete Specifies the color of active link (while the mouse button is held down during a click) in a document.
background URL Obsolete Specifies a background image for the document.
bgcolor color Obsolete Specifies the background color of the document.
link color Obsolete Specifies the color of unvisited links in a document.
text color Obsolete Specifies the foreground color for text in a document.
vlink color Obsolete Specifies the color of visited links (links that have already been followed) in a document.

Global Attributes

Like all other HTML tags, the <body> tag supports the global attributes in HTML5.

Event Attributes

The <body> tag also supports the event attributes in HTML5.

Browser Compatibility

The <body> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 2+
  • Apple Safari 1+
  • Opera 2.1+

Further Reading

See tutorial on: HTML Introduction.

Related tags: <html>, <head>.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties