The <body> tag in HTML defines the main content of a web page and is always placed within the <html> tag as its last child. It contains everything that is visible on the page, including headings,paragraphs,images,links, tables, and lists.
- The
<body>tag is required in every HTML document. - If omitted, most browsers will still render the content as if the tag were present, but it’s not considered good practice.
Syntax
<body> Body Contents... </body>
HTML Body Structure
<!DOCTYPE html>
<html lang="en">
<body>
<h3>GeeksforGeeks</h3>
<p>This is paragraph text</p>
</body>
</html>
Output

Attributes
There are many attributes in the <body> tag that are depreciated from HTML5 are listed below:
Attribute Values | Description |
|---|---|
It contains the URL of the background image. It is used to set the background image. | |
It is used to specify the background color of an image. | |
It is used to specify the color of the active link. | |
It is used to specify the color of visited links. | |
It specifies the color of the text in a document. | |
It specifies the color of visited links. |
Body tag with CSS implementation
<!DOCTYPE html>
<html lang="en">
<body style="background-color:seagreen">
<h3>HTML body Tag</h3>
<p>
This is paragraph Tag and it's background-color is seagreen.
</p>
</body>
</html>
Output

HTML <body> Tag Example with Hyperlink
<!DOCTYPE html>
<html>
<head>
<title>HTML LINKS</title>
</head>
<body>
<h2>Welcome To GFG</h2>
<a href="https://www.geeksforgeeks.org/community/">GFG Community</a>
</body>
</html>
Output

HTML <body> Tag with Text Color Attribute
<!DOCTYPE html>
<html>
<head>
<title>GFG color</title>
</head>
<body text="green">
<h2>Welcome To GFG</h2>
<p>Body Text color changed to green.</p>
</body>
</html>
Output
