HTML / HTML Tags

HTML <Body> Tag

Dec 12, 2022
1 min read
HTML body Tag

Definition

The body tag is one of the most important html tags. It defines the document’s body and contains all the HTML document contents, including headings, images, tables, lists, paragraphs, and more.

Example

<html>
  <head>
    <title>Document title</title>
  </head>
  <body>
    <p>This is a paragraph</p>
  </body>
</html>

Usage

  • You can only use the <body> element once.
  • It should be the second element inside the <html> tag and below the <head> element.
  • A <body> element’s opening tag may be omitted if either:
    • The element is empty
    • If the first thing inside the <body> element is not a space character or a comment element, except if the first item inside the <body> element is a meta, link, script, style, or template element.
  • A <body> element’s end tag is not required unless a comment immediately follows it.

Attributes

The Body element only supports the Global Attributes and Event Attributes.

Specification

Browser Support

Desktop

ChromeEdgeFirefoxIEOperaSafari
YesYesYesYesYesYes

Mobile

Android WebviewChrome AndroidFirefox AndroidOpera AndroidiOS SafariSamsung Internet
YesYesYesYesYesYes