Ryan's District
October 13, 2008, 01:06:32 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length

There are currently users in chat
News: Ryan's District Lottery: Claim your ticket or check
Jackpot details  
 
   Home   Help Search Chat Calendar Chess Shop Login Register  
Digg This!
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: HTML - Removing browser padding  (Read 1934 times)
0 Members and 1 Guest are viewing this topic.
ben2ong2
Quality Poster
Paid
Hero Member
*****

Reputation: 17
Offline Offline

Gender: Male
Posts: 2374
9976.80 RD$

View Inventory
Send Money to ben2ong2

View Profile Awards
« on: October 03, 2006, 05:20:40 PM »

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>

Logged

You are not allowed to view links.
Register or Login
Free Paid Survey & Home Business Resources.

You are not allowed to view links.
Register or Login
Free Article Directory | Quality Content
Ryan's District
« on: October 03, 2006, 05:20:40 PM »

 Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

Archive - WAP2 - WAP - imode
Sponsors: TOP SEO Directory - Online Job Maker - List of Advertisers - BIG VENUE

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.197 seconds with 30 queries.

Google visited last this page Yesterday at 10:16:52 AM