HTML body Tag

The <body> element in HTML is used to define the main content of a web page. Everything inside the <body> tags is displayed in the main content area of a web browser window.

Here is an example of basic HTML structure with a <body> tag

<html>
  <head>
    <title>My first HTML page</title>
  </head>
  <body>
    <!-- Main content goes here -->
    <h1>Hello, World!</h1>
    <p>This is a sample paragraph.</p>
  </body>
</html>

Inside the <body> tag, you can use a variety of HTML elements such as headings, paragraphs, lists, images, links, and many others to create the content of your web page.

HTML Body tag contains all the text formatting and images that make up the pages together with all the HTML tags that provide the control and formatting of the page.


The body tag has the following attributes.
BACKGROUND (Deprecated HTML 5)
The body background attribute defines or points to the image which will display as image as tiled across the browser windows. providing a background for the document.
BGCOLOR (Deprecated HTML 5) BGCOLOR

Body bgcolor attribute sets the background color for the documents.
TEXT (Deprecated HTML 5)

Body text attribute is set the color of all the normal text in the document.

HTML Body Tag attribute

The body tag in HTML is used to define the main content of a web page. It can contain various elements such as text, images, links, tables, and more. There are several attributes that can be used with the body tag, including:

  1. background: This attribute sets the background color or image of the body of the web page. Example:

<body background=”background.jpg”>

  1. bgcolor: This attribute sets the background color of the body of the web page. Example:

<body bgcolor=”#FFFFFF”>

  1. text: This attribute sets the color of the text in the body of the web page. Example:

<body text=”#000000″>

  1. link: This attribute sets the color of the unvisited links in the body of the web page. Example:

<body link=”#0000FF”>

  1. vlink: This attribute sets the color of the visited links in the body of the web page. Example:

<body vlink=”#800000″>

  1. alink: This attribute sets the color of the active links in the body of the web page. Example:

<body alink=”#FF0000″>