Body HTML

HTML <body> Tag

The main content of an HTML document is defined inside the HTML <body> tag. Only the content inside the HTML <body> tag is meant to be displayed on the browser. The content can vary from simple text to paragraphs, headings, images, tables, links, videos, etc. It is placed after the <head> tag or between </head> and </html> tags. In an HTML document, the <body> tag is used only once and is required for every HTML document.

Syntax:

<body>content</body>

Example:

<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
Hello World!!
</body>
</html>

Explanation:

In the above example, we have displayed an HTML document with some basic tags.

Tag specific Attributes:

Attribute Value Uses HTML5
alink color To specify the color of the active link in a document. Not supported in HTML 5.
background URL To specify the background image of the document. Not supported in HTML 5.
bgcolor color To specify the background color of the content. Not supported in HTML 5.
link color To specify the color of the unvisited link. Not supported in HTML 5.
text color To specify the color of the text in the document. Not supported in HTML 5.
vlink color To specify the color of the visited link. Not supported in HTML 5.
onload To call a function on page loading. Supported in HTML 5.
onunload To call a function when the user leaves the page. Supported in HTML 5
onfocus To call a function when the document receives focus from the user. Supported in HTML 5
onblur To call a function when a document loses focus by the user. Supported in HTML 5

Global Attributes:

All the Global attributes are supported by the HTML <body> tag.

Event Attributes:

All the Event attributes are supported by the HTML <body> tag.

Supporting Browsers:

Chrome, IE, Firefox, Opera, and Safari.