Since the inception of the very first HTML document, margins existed that surrounded the document, like in the case with this document.

The margins are there to act as a cushion between the edges of the browser and the contents of the page, so it's easier to read the content.

As good as margins are, wouldn't it be nice to be able to eliminate them in some cases, where the design of the page calls for their termination? While most webmasters think it is not possible to "flush out" the default margins of a HTML document, it actually is, although only possible in IE 3+, and NS 4+. In this tutorial, I'll show you how.

Eliminating The Document Margin In IE 3+

To get rid of the document margin in IE 3 and above, so content presses right against the edges of the browser, use the IE exclusive "leftmargin" and "topmargin" attributes:

<body leftmargin="0" topmargin="0">

It's as simple as that!

Eliminating The Document Margin In NS 4+

To get rid of the document margin in NS 4 and above, use the NS 4 exclusive "marginwidth" and "marginheight" attributes instead:

<body marginwidth="0" marginheight="0">

Putting It All Together.

By putting the two techniques together, we can create a document that flushes out its' margins in both IE 3+ and NS 4+:

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

Try out the above coding on your page, and you'll see what I mean.

Article written by Lee.

http://www.webmasterconsultants.com