HTML - <body> tag

  »   HTML  »   HTML Tutorial - <body> tag. Web page content

As we have mentioned earlier in another tutorial, the <body> tag is the one that contains everything that will be shown on a web page: tables, forms, paragraphs, photos, and anything else.

All this are entered between <body> and </body> tag.

HTML - Attributes of the body tag

  • leftmargin - establishes an edge in the left side of the page (an empty space)
  • topmargin - establishes an edge in the top side of the page (an empty space).

An example would be:

html<body topmargin="50">
This text is located at a distance of 50 pixels of the top of the page
</body>
html<body leftmargin="50">
This text is located at a distance of 50 pixels to the left of the page
</body>

You can copy this code into a notepad file, saving it as .html to view it best.

HTML - Text color established by the body tag

html<body text="red" >
or
<body text="rgb(255,0,0)" >

This part of the code will set the base font color as red, in case another color is not specified within the paragraph tag, <p>.

HTML - Link color set by the body tag

Same as the text, you can set the viewed or not viewed links color with the help of the body tag.

html<body link="white" vlink="black" >
or
<body link="rgb(255,255,255)" vlink="rgb(0,0,0)" >

This method is used very rarely though, using the CSS (Cascading Style Sheets) being much easier and more practical.