D-Zine - Precision Design :
MARGINS








The most important HTML tag, with relevance to the page as a whole, is the <body> tag. This is where you can specify the background and margins for the page as well as the color of the links.

MARGINS

Microsoft Internet Explorer and Netscape browsers have different attributes for page margins.
Both have a default margin of 10 pixels – so if you don’t specify a margin attribute, your page will have a top and left margin as default.

In Microsoft Internet Explorer you can use these attributes:
  • leftmargin=”value”

  • topmargin=”value”

In Netscape browsers you can use these attributes:
  • marginwidth=”value”

  • marginheight=”value”

Now, in order to make sure that the page has the exact same margins (no matter which browser it’s viewed on), you will need to add all four attributes. Since browsers forget about attributes that they do not recognize, it will not result in an error when the one browser sees the attributes that are only supported by the other browser.

This means, that MSIE will recognize and use the leftmargin and topmargin attributes while it simply forgets about the marginwidth and marginheight attributes. Netscape will do the exact same – only the other way around.

Look at this example:
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">

This will result in a page where the content will start at the very top and to the very left of the browser window.

 << PREVIOUS
READ MORE >>  
















DEVELOPER TIP!





     "Better Than Books - As Easy As It Gets!"