Removing browser padding
Sponsored Links
Both Internet Explorer and Netscape Communicator introduce padding between their edges and contents. Padding is the blank space between the inside edge of the browser window and the actual web page contents. This padding can range from 10 to 12 pixels depending on the browser, platform and version. Here we'll look at a simple HTML trick to remove the padding around web page contents.
You would have noticed that this page however, has no such padding and the contents are placed flush against the edges.
You can remove the padding either by using frames or using specific attributes to <body> tag and style sheets. This web site employs the latter method.
To remove padding you include four attributes in the body tag as:
<body marginwidth="0" marginheight="0 leftmargin="0" topmargin="0">
Netscape uses marginwidth and marginheight while Internet Explorer uses leftmargin and topmargin. Since we have set all these attributes to 0, the web page will be displayed without any padding.
Internet Explorer follows style sheets better than Netscape. Thus, we can do away with the I.E. specific attributes (leftmargin and topmargin) in the BODY tag by using the margin property in style sheets.
body {margin:0}
Note: we have set the margin property to 0 and assigned it to the body selector. This style is placed inside the HTML head between <style> - </style> tags or in an external .css file. Since I.E. recognizes this style, we no longer need leftmargin and topmargin and can remove them from the <body> tag.
The final document should look like:
<html>
<head><title>Some title</title>
<style>
body {margin:0}
<style>
</head>
<body marginwidth="0" marginheight="0">
...
Contents
...
</body>
</html>
Comments, questions, feedback... whatever!
Page contents: details on removing browser padding or extra space around web page contents.
Recent Articles
Recent Blog Posts
Popular Articles
- Hotmail Sign In page
- Create a Hotmail account - Instructions
- Create Gmail address
- Download and install Outlook Express
- Get your free Gmail address
- Outlook Express new version
- Create my own email address
- Browers for Windows list
- Get email address
- Color combinations for web sites and pages
- Create Yahoo ID
More web tips & tricks
- Outlook Express Help - tips & tricks (53)
- Windows Live Mail help and tips (36)
- Windows Mail help (25)
- Hotmail help and tips (42)
- Yahoo help & support (45)
- AOL email help (26)
- Gmail help and tips (36)
- Internet tips & tricks (12)
- Web Design tips & tricks (33)
- HTML, Javascript tips tricks (68)
- Web Promotion tips & tricks (8)
- Graphics tips & tricks (20)




