HTML Body Tag

Body Tag in HTML

The <body> tag defines the main body of your document in which you placed all the content for example text, hyperlinks, images, tables, lists, etc. <body> element have number of attribute which control the overall document appearance. For example bgcolor controls the background color of the web page. The body tag must start immediately after the closing head tag and end directly before the closing html tag.

For example









Following are the most important attribute of BODY Tag

BGCOLOR: background color of the page
BACKGROUND: background picture for the page
TEXT: color of the text on the page
LINK: color of links that haven't been followed yet
VLINK: color of links that have been followed
ALINK: color of links while you are clicking on them
BGPROPERTIES: if the background image should not scroll
TOPMARGIN: size of top and bottom margins
LEFTMARGIN: size of left and right margins

MARGINHEIGHT: size of top and bottom margins
MARGINWIDTH: size of left and right margins
onLoad: Script to run once the page is fully loaded

==>Now write this code in any text editor and save the file test.html and then open this file in your web browser .


<meta name="description" content="learning hints test Page"/>
<meta name="author" content="Nida Malik"/>
<meta name="copyright" content="Learning Hints" />
<meta name="keywords" content="tutorials, video tutorials, notes,exam papers"/>
<meta name="copyright" content="Learning Hints" />
<BODY bgcolor="Black" text="white">
This is very first line in my page with black background and white text color.


In old HTML most of tag used in following way

<li>item 1
<li>Item 2
<li>Item 3

So<li> tag have no closing tag.

In XHTML all tags were required to have both a start tag and an end tag, so now the old tag are replace as following:

<li>item 1</li>
<li>Item 2</li>
<li>Item 3</li>

 But in some element such as <br> there is no closing tag. So to overcome this problem an other technique is introduced that is if ant tag have no closing tag then the starting tag is ended with forward slash for example <br/>.

So you must put forward slash in meta tag because there is no closing tag.