
HTML body Tag
The <body>
tag in HTML is used to define the main content area of an HTML document. It represents the visible content of a webpage that is displayed within a web browser.
Here’s an example of how the <body>
tag is used in an HTML document:
<!DOCTYPE html>
<html>
<head>
<title>My Webpage</title>
</head>
<body>
<h1>Welcome to My Webpage</h1>
<p>This is the main content of my webpage.</p>
</body>
</html>
In the example above, the <body>
tag encloses the main content of the webpage, including the heading (<h1>
) and paragraph (<p>
) elements. Anything placed within the <body>
tags will be rendered by the web browser and displayed to the user.
The <body>
tag is one of the essential tags in HTML and is required in every HTML document. It is responsible for containing the content that users see and interact with on a webpage, such as text, images, links, forms, and more.
It’s important to note that the <body>
tag should be placed inside the <html>
tag and before the closing </html>
tag. The <head>
section, which contains metadata and other document-level information, comes before the <body>
section.
You can apply CSS styles, script tags, and other HTML elements within the <body>
section to structure and style the content of your webpage according to your needs.
Overall, the <body>
tag is a fundamental element in HTML that defines the visible content area of a webpage, providing the structure and layout for displaying information to users.