HTML <body> tag

Updated: 11/13/2018 by Computer Hope
HTML body tag

When writing in HTML, the <body> tag is used to contain a web page's content, including hyperlinks, images, tables, text, etc. It is required in every HTML document, and there may only be one <body> tag per page. The following sections contain information about this tag, including related attributes and browser compatibility.

Example of the <body> code

Below is an example of HTML with the body tag and its contents highlighted in bold text.

<!doctype html>
<meta charset="utf-8">
<title>Example page</title>
<h1>This is a heading</h1>
<p>This is an example of a basic HTML page.</p>


Deprecated attributes

Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. Every attribute unique to the <body> tag is deprecated, meaning that it may function currently, but is not supported in going forward. In this case, CSS should be used in place of these attributes.

Attribute Description
alink Designates the color a link turns when it is selected.
background Designates the background image on a page.
bgcolor Designates the background color on a page.
link Designates the color of a link not yet been clicked.
text Designates the color of text on a page.
vlink Designates the color of visited links.


Edge Internet Explorer Firefox Safari Opera Chrome
All versions All versions All versions All version All versions All versions

Browser, Compatibility, CSS, Hyperlink, Image, Table, Text, Web design terms