Solved

Why does IE add extra space to my table?

Posted on 2008-11-01
2
817 Views
Last Modified: 2012-05-05
It seems like days I've been trying to figure this out. On this page:

http://www.glowfishtw.com/flagfootball/index3.asp

IE and Chrome (compared to FireFox) are putting extra space in between the search box and the links beneath it. I need a way to make the spacing the same across all browsers. Any ideas? Thanks.

Page code is attached.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<style type="text/css">

<!--

A { text-decoration:none;}

A:link	{color:blue;}

A:hover	{color: red;}

A:visited {color:blue;}

 .tab {font-size:12px;font-family:Arial,Helvetica;color:#CCCCCC;}

 .tabb {font-size:14px; font-family:Arial,Helvetica;}
 

body {

	font: 100% Verdana, Arial, Helvetica, sans-serif;

	background: #666666;

	margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */

	padding: 0;

	text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */

	color: #000000;

	height: 200px;

}

.oneColFixCtrHdr #container {

	width: 780px;  /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */

	background: #FFFFFF;

	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */

	border: 1px solid #000000;

	text-align: center; /* this overrides the text-align: center on the body element. */

}

.oneColFixCtrHdr #header {

	padding: 0 0px 0 0px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */

	text-align: center;

	background-color: #000C60;

}

.tophalf {

	background-image: url(images/tophalfbbg.jpg);

	background-repeat: repeat-x;

	height: 100px;

}

a:link {

	color: #CCCCCC;

}

.oneColFixCtrHdr #header h1 {

	margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */

	padding: 0px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */

}

.oneColFixCtrHdr #mainContent {

	padding: 0 0px; /* remember that padding is the space inside the div box and margin is the space outside the div box */

	background: #FFFFFF;

}

.oneColFixCtrHdr #footer {

	padding: 0 0px; /* this padding matches the left alignment of the elements in the divs that appear above it. */

	background:#DDDDDD;

}

.oneColFixCtrHdr #footer p {

	margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */

	padding: 0px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */

}
 

.style3 {

	font-size: 10px;

	font-weight: bold;

	font-family: Arial, Helvetica, sans-serif;

	color: #FFFFFF;

}

.style5 {

	font-size: 6pt;

	color: #CCCCCC;

}

-->

</style>

<SCRIPT LANGUAGE="JavaScript">
 

/***********************************

*   http://javascripts.vbarsan.com/

*   This notice may not be removed 

***********************************/
 

//-- Begin Scroller's Parameters and message -->

//scroller width: change to your own;

var wwidth=770;
 

//scroller height: change to your own;

var wheight=20;
 

//background color: change to your own; 

var wbcolor="#ccffcc";
 

//scroller's speed: change to your own;

var sspeed=2;

var restart=sspeed;

var rspeed=sspeed;
 

//text: change to your own
 

wwholemessage='<nobr class=tab><b>News Scroller Horizontal v2.2 => '+

'<a class=tabb href="http://javascripts.vbarsan.com">'+

'Vertical Scroller JavaScript 7.0 + Horizontal Scroller JavaScript 7.0 + Typewriter Scroller JavaScript 5.0</a> <= Text Scroller Horizontal v2.2</b></nobr>';
 

//-- end Parameters and message-->
 

//-- begin: Scroller's Algorithm -->

var sizeupw=0;var operbr=navigator.userAgent.toLowerCase().indexOf('opera');if(operbr==-1&&navigator.product&&navigator.product=="Gecko"){var agt = navigator.userAgent.toLowerCase();var rvStart = agt.indexOf('rv:');var rvEnd = agt.indexOf(')', rvStart);var check15 = agt.substring(rvStart+3, rvEnd);if(parseFloat(check15)>=1.8) operbr=0;}if (navigator.appVersion.indexOf("Mac")!=-1)operbr=0;

function goup(){if(sspeed!=rspeed*8){sspeed=sspeed*2;restart=sspeed;}}

function godown(){if(sspeed>rspeed){sspeed=sspeed/2;restart=sspeed;}}

function startw(){if(document.getElementById)ns6marqueew(document.getElementById('wslider'));else if(document.all) iemarqueew(wslider);else if(document.layers)ns4marqueew(document.wslider1.document.wslider2);}function iemarqueew(whichdiv){iedivw=eval(whichdiv);iedivw.style.pixelLeft=wwidth+"px";iedivw.innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=iedivw.offsetWidth;ieslidew();}function ieslidew(){if(iedivw.style.pixelLeft>=sizeupw*(-1)){iedivw.style.pixelLeft-=sspeed+"px";setTimeout("ieslidew()",100);}else{iedivw.style.pixelLeft=wwidth+"px";ieslidew();}}function ns4marqueew(whichlayer){ns4layerw=eval(whichlayer);ns4layerw.left=wwidth;ns4layerw.document.write('<nobr>'+wwholemessage+'</nobr>');ns4layerw.document.close();sizeupw=ns4layerw.document.width;ns4slidew();}function ns4slidew(){if(ns4layerw.left>=sizeupw*(-1)){ns4layerw.left-=sspeed;setTimeout("ns4slidew()",100);}else{ns4layerw.left=wwidth;ns4slidew();}}function ns6marqueew(whichdiv){ns6divw=eval(whichdiv);ns6divw.style.left=wwidth+"px";ns6divw.innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=ns6divw.offsetWidth;if(operbr!=-1){document.getElementById('operaslider').innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=document.getElementById('operaslider').offsetWidth;}ns6slidew();}function ns6slidew(){if(parseInt(ns6divw.style.left)>=sizeupw*(-1)){ns6divw.style.left=parseInt(ns6divw.style.left)-sspeed+"px";setTimeout("ns6slidew()",100);}else{ns6divw.style.left=wwidth+"px";ns6slidew();}}

//-- end Algorithm -->

</script>

<!-- End of Script between <head> & </head> tags-->
 

<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>

</head>
 

<body class="oneColFixCtrHdr"; onload="startw(); document.getElementById('wslider').style.top = '10%';">
 

<div id="container">

  <div id="header" align="center">

<!-- You may remove first cell below (<td> ... </td>) to get rid of Speed-change -->

<script language="JavaScript">document.write('<table align="center" border="0"><tr><td width='+wwidth+'px>');if(document.getElementById || document.all){document.write('<span style="width:'+wwidth+'px;"><div style="position:relative;overflow:hidden;width:'+wwidth+'px;height:'+wheight+'px;clip:rect(0 '+wwidth+'px '+wheight+'px 0);background-image: url(images/topbar.jpg);" onMouseover="sspeed=0;" onMouseout="sspeed=restart">');if(operbr!=-1)document.write('<div id="operaslider" style="position:absolute;visibility:hidden;"></div>');document.write('<div id="wslider" style="position:absolute;height:'+wheight+'px;"></div></div></span>')}</script>

<ilayer width=&{wwidth}; height=&{wheight}; name="wslider1" bgcolor=&{wbcolor};><layer name="wslider2" width=&{wwidth}; height=&{wheight}; onMouseover="sspeed=0;" onMouseout="sspeed=restart"></layer></ilayer></td></tr></table>

<!-- end  of code between BODY TAGS -->
 

  </div>

  <div class="tophalf">

    <table width="233" height="62" align="center"0">

  <tr>

    <td height="14" valign="top"><div align="left"><span class="style3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Search Flag Football</span></div></td>

  </tr>

  <tr>

    <td height="26" valign="top"><div align="left">

      <form method="get" action="http://www.google.com/custom">
 

                  <input type="text" name="q" size="20" maxlength="255" value="" />

					<input type="submit" name="btnG" value="Search" />

					  <input type="hidden" name="sitesearch" value="www.glowfishtw.com" />

			</form>	

    </div></td>

  </tr>

  <tr>

    <td height="12" valign="top"><div align="center"><span class="style5">- <a href="javascript:void(0)">register</a> - <a href="javascript:void(0)">schedule</a> - <a href="javascript:void(0)">old site</a> - <a href="javascript:void(0)">adult league</a> - </span></div></td>

  </tr>

</table>

</div>

  

  

  <div id="mainContent">

    <h1> Main Content </h1>

    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at,  odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. Fusce  varius urna id quam. Sed neque mi, varius eget, tincidunt nec, suscipit id,  libero. In eget purus. Vestibulum ut nisl. Donec eu mi sed turpis feugiat  feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut,  sapien. Fusce metus mi, eleifend sollicitudin, molestie id, varius et, nibh.  Donec nec libero.</p>

    <h2>H2 level heading </h2>

    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis  ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean  sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p>

	<!-- end #mainContent --></div>

  <div id="footer">

    <p>Footer</p>

  <!-- end #footer --></div>

<!-- end #container --></div>

</body>

</html>

Open in new window

0
Comment
Question by:elliottbenzle
2 Comments
 
LVL 31

Expert Comment

by:Frosty555
ID: 22860442
Try tightening up your whitespace after the closing </form> tag and before the closing </div> tag. Your formatting might be misinterpreted by IE as intentional whitespace.
...

  <tr>

    <td height="26" valign="top"><div align="left">

      <form method="get" action="http://www.google.com/custom">

 

                  <input type="text" name="q" size="20" maxlength="255" value="" />

					<input type="submit" name="btnG" value="Search" />

					  <input type="hidden" name="sitesearch" value="www.glowfishtw.com" />

			</form></div></td>

</tr>

...

Open in new window

0
 
LVL 2

Accepted Solution

by:
devshb earned 500 total points
ID: 22860962
In Internet Explorer, form tags often create spurious whitespace (just an ie bug, or "by design feature" as I guess microsoft might call it)

To get rid of the spurious whitespace move the form tags so that they're outside the "<td>" and "</td>" tags, eg so that it's more like the attached example, this makes the form tags invisible as far as the browser is concerned, but the form tags still get processed properly when it comes to posting or javascript etc.
<table>

<tr>

<form blah>

<td>html content</td>

</form>

</tr>

</table>

Open in new window

0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article discusses four methods for overlaying images in a container on a web page
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now