By default, Web browsers put some extra whitespace between the browser interface and the start of the page. This comes in handy when you have a text-only Web page, but many types of designsespecially liquid layoutsdon't feel right with the extra padding.
You can turn off the extra padding by setting a couple of attributes in the body tag to 0. Which attributes you use depends on the browser. In Internet Explorer, the appropriate attributes are leftmargin and topmargin: <body leftmargin="0" topmargin="0"> In Netscape browsers, the attributes are marginwidth and marginheight: <body marginwidth="0" marginheight="0"> If you're smart, you'll use all four: <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> Conversely, you can create extra padding by setting these attributes to nonzero values. The leftmargin and topmargin attributes in IE control the amount of spacing along the left and top of the browser window, respectively, but do nothing to the right and bottom, while the Netscape attributes supply spacing equally to the left and right with marginwidth and to the top and bottom with marginheight. Remember, IE doesn't understand the Netscape attributes and vice versa, so you can't get extra right-margin padding by setting marginwidth in IE. Likewise, you can't affect the left side of the browser window only by setting leftmargin in Netscape. For a better level of margin control overall, try using CSS instead of HTML (see Topic 26). |