HTML <body> Tag

Description

The <body> HTML tag is a fundamental component of every HTML document. It represents the content of an HTML document, including text, images, links, forms, and other elements that are visible to the user on a web page. Everything that users see and interact with on a website is contained within the <body> tag. This tag acts as a container for all the visible content, providing the structure and layout for the web page. Any content placed between the opening <body> tag and the closing </body> tag is displayed in the main browser window when someone visits a website. Developers use various HTML elements within the <body> tag to create a visually appealing and interactive user experience on the web.

Properties

Permitted Parents
It must be the second element of an <html> element.
Content
Block, inline and text
Start/End Tags
Start tag: optional, End tag: optional

Example

<html>
<head>
<title>Title of the document</title>
</head>
<body>
The content of the document......
</body>
</html>

Attributes

Attribute Definition
background Specifies the URI/URL of a background image. This attribute is now deprecated.
text Specifies the URI/URL of a background image. This attribute is now deprecated.
link Specifies the color of unvisited hyperlink text. This attribute is now deprecated.
alink Specifies the color of active hyperlink text (i.e. when the user clicks on it). This attribute is now deprecated.
vlink Specifies the color of visited hyperlink text. This attribute is now deprecated.

Global Attributes

The <body> tag also supports the Global Attributes in HTML5

Event Attributes

The <body> tag also supports the Event Attributes in HTML5

Browser Support

The following table will show you the current browser support for the HTML <body> tag.

Desktop
Edge Chrome Firefox Opera Safari
1211151
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
18414114.4

Last updated by CSSPortal on: 30th September 2023