Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extra space in IE compared to Firefox

Status
Not open for further replies.

jawa500

Programmer
Dec 18, 2002
8
EU
I am trying to put a spacer between say two tables, a 1px x 1px image and using height of img tag to adjust.

I Firefox it is OK but in IE extra space appears. I have tried setting margins and padding to 0.

See sample code where the extra space can be seen between the elements.

Code:
<html><head>
<style>
img {PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px}
table {PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px}
body {PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px}
</style>

</head>
<body>

<table cellpadding = 0 cellspacing = 0 border = 1><tr><td>dfgfg</td></tr></table>
<img src="1px.jpg" height=1 border = 1>
<table cellpadding = 0 cellspacing = 0 border = 1><tr><td>dfgfg</td></tr></table>

</body></html>

------------------------------------------
the only shopping site you need to bookmark
 
For the love of god, no. Try this:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]

<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
  <head>
    <title>Two tables</title>
    <style type="text/css">
      body { padding: 0; margin: 0; }
      table { padding: 0; margin: 0; margin-bottom: 1px; }
    </style>
  </head>
  <body>
    <table cellpadding="0" cellspacing="0" border="1"><tr><td>dfgfg</td></tr></table>
    <table cellpadding="0" cellspacing="0" border="1"><tr><td>dfgfg</td></tr></table>
  </body>
</html>
 
You have to run the closing table tag, the image tag, and the next table into one line to avoid unwanted extra white space:

</table><img src="1px.jpg" height=1><table>
<tr><td>

but Vragabond has posted a better method.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top