HTML Tags

HTML <body> Tag

The <body> tag defines the main content area of an HTML document. It contains all the elements that are visible to users on a web page - such as text, images, videos, links, tables, lists, and forms. Everything that appears in a browser window (excluding metadata) must be placed inside the <body> tag.

Syntax

html

<body>
  <!-- Visible content goes here -->
</body>

Example

html

<!DOCTYPE html>
<html>
<head>
  <title>Body Tag Example</title>
</head>
<body>
  <h1>Welcome to My Webpage</h1>
  <p>This content is inside the body tag.</p>
  <img src="https://picsum.photos/seed/picsum/400/300" alt="Sample Image" width="400">
</body>
</html>

Output

Browser Output

html

Use our Try it Editor to see the output

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

The content of <body> tag are visible things and can be displayed in the web browser.

Notes

  • Each HTML document can have only one <body> tag.
  • All content elements such as headings, paragraphs, lists, links, tables, etc., must be placed inside the <body>.
  • The <body> tag should not contain <head> elements or metadata.
  • Inline styling and event attributes (like onload or onresize) can be applied to the <body> tag.
  • Without the <body> tag, browsers may render content unpredictably or fail HTML validation.

Conclusion

The <body> tag is a fundamental structural component of any HTML document. It represents the main section that users see and interact with. Proper use of the <body> tag ensures a well-structured, valid, and correctly rendered webpage.