As we have mentioned earlier in another tutorial, the <body> tag is the one that contains everything that will be shown in 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
HTML<body leftmargin="50">
This text is located at a distance of 50 pixels to the left of the page

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" >
<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" >
<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.

Leave a Reply

Your email address will not be published. Required fields are marked *