Setting the Top Margin

| Back | Home | Next |

Web pages begin the text by default at the top edge of your browser window. Occasionally, this crowds the page near the top. One way to force extra space is with a series of <BR> tags. To precisely set the amount of white space at the beginning of your web page, you can set the margin of your page. To set the margin to a specific number of pixels use the following example:

<BODY TOPMARGIN="25">

This page was set using a TOPMARGIN of 25 pixels. The back and next buttons are the first lines of code after the <BODY> tag. The additional white space is visible in Internet Explorer because the use of TOPMARGIN forces a wider margin than the default of none. Netscape does not support the TOPMARGIN attribute.

In setting the margin using pixels, keep in mind that in all browsers, 72 pixels is displayed as one inch. So a one inch margin at the top would be:

<BODY TOPMARGIN="72">

To combine left margin and top margin, include both attributes in the <BODY> tag:

<BODY LEFTMARGIN="75" TOPMARGIN="75">