<body>
Tag The HTML <body>
Tag
The <body>
tag in HTML is used to define the main content of a webpage. It contains all the visible content such as text, images, links, and other elements that are displayed on the page.
Usage of the <body>
Tag
The <body>
tag is a required tag in HTML documents and is used to encapsulate all the content that will be displayed on the webpage. It is placed within the <html>
tag and comes after the <head>
tag.
Main Attributes of the <body>
Tag
The <body>
tag does not have many attributes, but it does have a few key attributes that can be used:
Attribute | Description |
---|---|
bgcolor |
Sets the background color of the webpage |
text |
Sets the default text color of the webpage |
link |
Sets the color of links that have not been visited |
vlink |
Sets the color of links that have been visited |
alink |
Sets the color of links when they are being clicked |
Examples of <body>
Tag
Here is an example of how the <body>
tag is used in an HTML document:
<html>
<head>
<title>My Webpage</title>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<h1>Welcome to My Webpage</h1>
<p>This is the main content of my webpage.</p>
<a href="https://www.example.com">Click here</a> to visit my website.
</body>
</html>