Description
HTML element <body>
is used to define the content of an HTML document, that displays on the screen.
It wraps around all the display elements like headings, paragraphs, images, hyperlinks, tables, forms, lists, videos, etc.,
The below table summarizes its usage.
Usage Details | |
Placement | It is a child of <html> element. |
Contents | It can contain Block elements, Inline elements, and text. |
Tags | Both opening and closing tags are required. |
Versions | HTML 2, 3.2, 4, 4.01, and 5 |
Syntax
<body>...</body>
Examples
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<h1>Heading</h1>
<p>Paragraph content goes here.</p>
</body>
</html>
Attributes
The following table shows the list of supported and unsupported attributes for the <body>
tag.
Attribute Type | Details |
Tag-Specific Attributes | The tag <body> does not have any tag-specific attributes. |
Global Attributes | Like all other HTML tags, the tag <body> supports the HTML Global Attributes. |
Event Attributes | The tag <body> also supports the HTML Event Attributes. |
Browser Compatibility
The tag <body>
is supported in all modern browsers.
- Google Chrome 1+
- Internet Explorer or Edge 2+
- Firefox 1+
- Apple Safari 1+
- Opera 2.1+