html tutorial - <body> - Body tag in HTML - html5 - html code - html form

body tag in html

Learn html - html tutorial - body tag in html - html examples - html programs

Definition of <body> tag:

  • The <body> tag encloses all the contents of an HTML document.
  • The body tag have all the contents of an web page like header tag, title tag, paragraph tag, image tag, and etc.,
  • It must be the second element of an <html> element.
  • The body tag is in the flow content category.
  • The <body> tag also support both Global Attribute and Event attribute.
learn html -  html tutorial -  html development tutorial -  html examples -  html  -  html script -  html program -  html download -  html samples  -  html scripts

Syntax for body tag:


Differences between HTML 4.01 and HTML5 for body tag:

HTML 4.0.1

alink, background, bgcolor, link, text, vlink attributes are used.


Layout attributes are removed.

Sample Coding for <body> tag:

Tryit<!DOCTYPE html>
  <html >
        Welcome to  

Code Explanation for <body> tag:

body tag code explanation

  1. Body tag - start with <body> and end with </body>.
  2. “Welcome to” - Defines in the body tag.

Output for <body> tag:

body tag output

  1. The term “Welcome to” is displayed in the output, which is declared within the body tag.

Browser Support for body tag:

Yes Yes Yes Yes Yes