BODY Tag
BODY Tag
The BODY tag contains all the text and graphics of the document with all the HTML tags that are used for control and formatting of the page.
The Format is:
<BODY>
Your Document goes here
</BODY>
An HTML document, web page can be created using a text editor, Notepad or WordPad. All the HTML documents should have the extension .htm or .html. It requires a web browser like Internet Explorer or Netscape Navigator/Communicator to view the document.
Attributes of <BODY> Tags
Attribute Name | Description | Possible value |
bgcolor | to set the background of page | color name or hexadecimal color code Ex: #FF0000 for Red color |
background | to set the background image in page | url or path |
topmargin | to define the margin from top of web page | pixel (px) or in percentage (%) |
leftmargin | to define the margin from left of web page in updated browser it work for both left & right margin | pixel (px) or in percentage (%) |
text | to set the text color of page | color name or color code in hexadecimal |
link | to set the color of link text | color name or color code in hexadecimal |
vlink | to set the color visited link | color name or color code in hexadecimal |
alink | to set the color of active link | color name or color code in hexadecimal |
BGCOLOR: used to set the background color for the document
Example:
<BODY BGCOLOR="yellow">
Your document text goes here.
</BODY>
TEXT: used to set the color of the text of the document
Example:
<BODY TEXT="red">
Document text changed to red color
</BODY>
LEFTMARGIN: set the left hand margin of the document
Example:
<BODY LEFTMARGIN="60">
This document is indented 60 pixels from
the left hand side of the page.
</BODY>
TOPMARGIN: set the left hand margin of the document
Example:
<BODY TOPMARGIN="60">
This document is indented 60 pixels from the top of the page.
</BODY>
BACKGROUND: It is used to point to an image file (the files with an extension .gif, .jpeg) that will be used as the background of the document. The image file will be tiled across the document.
Example:
<BODY BACKGROUND="filename.gif">
Your document text goes here
</BODY>
LINK: to set the color of link text. the default color of link is blue.
<BODY LINK="RED"> <a href="https://infomaxacademy.com"> Infomax Academy</a> </BODY>VLINK : to set the color of visited link. The default color for visited link is purple.
<BODY VLINK="GREEN"> <a href="https://infomaxacademy.com"> Infomax Academy</a> </BODY>
ALINK : to set the color of active link i.e. when we click on a link.
<BODY ALINK="YELLOW"> <a href="https://infomaxacademy.com"> Infomax Academy</a> </BODY>
Lab Assignment