HTML Body Tag
The <body> tag is one of the most essential tags in any HTML document. It represents the main content area of the web page — the part that you actually see and interact with in the browser.
Everything inside the <body> tag is what the user sees. Everything outside it (like the <head> tag) is for browser use, settings, or metadata.
Where is the <body> Tag Used?
The <body> tag is placed inside the <html> tag, right after the <head> section.
<!DOCTYPE html>
<html>
<head>
<title>My Webpage</title>
</head>
<body>
<!-- All visible content goes here -->
</body>
</html>
Syntax -
<body attributes>.. text/tags here.. </body>
Attribute | Description | Values |
---|---|---|
Alink | Sets color of active (clicked) links | Color |
Background | Specifies the background image | URL |
Bgcolor | Sets background color | Color |
Link | Sets color of normal links | Color |
Text | Sets text color | Color |
Vlink | Sets color of visited links | Color |
Example -
Scenario - Example Using <body> Tag
<!DOCTYPE html>
<html>
<head>
<title> Body element example.. </title>
</head>
<body>
<h1>Welcome to TutorialsCampus</h1>
<p>This is a paragraph inside the body tag.</p>
<a href="https://tutorialscampus.com">Visit Website Home</a>
</body>
</html>
Output -
Explaining Example -
What you see in the browser:
- A heading that says “Welcome to TutorialsCampus”.
- A paragraph with some text
- A clickable link