HTML <body> tag
Updated: 09/12/2023 by Computer Hope
When writing in HTML (hypertext markup language), 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>
<html>
<head>
<meta charset="utf-8">
<title>Example page</title>
</head>
<body>
<h1>This is a heading</h1>
<p>This is an example of a basic HTML page.</p>
</body>
</html>
Deprecated attributes
All HTML tags support standard attributes that define the settings of an HTML element. In addition to the standard settings, the <body> tag had the following unique attributes that are now deprecated.
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. |
Compatibility
Edge | Internet Explorer | Firefox | Safari | Opera | Chrome |
---|---|---|---|---|---|
All versions | All versions | All versions | All version | All versions | All versions |
Browser, Compatibility, Container tag, CSS, Hyperlink, Image, Table, Text, Web design terms