I had another problem that I ended up fixing. I was trying to apply a css style to a cell in order to repeat an image as a drop shadow column. It will only work in internet explorer. Ever since doing that, even though I have deleted it, now I get a gap between my footer and the rest of the table. Here is the html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
table {
  border-collapse: collapse;
body {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	background: #FFFFFF;
	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;
	background-image: url(Assets/AheadPagerTemplate_r1_c1.gif);
	background-repeat: repeat-x;
	background-color: #80B6A5;
.oneColFixCtrHdr #container {
	width: 900px;  /* 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: 0px solid;
	text-align: left; /* this overrides the text-align: center on the body element. */
.oneColFixCtrHdr #header {
	background: #FFFFFF; 
	/*padding: 0 2px 0 2px;  /* 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. */
.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: 2px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
.oneColFixCtrHdr #mainContent {
	/*padding: 3px 3px 3px 3px; /* 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 2px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
.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: 2px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
.oneColFixCtrHdr #container #mainContent table {
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

<body class="oneColFixCtrHdr" onload="MM_preloadImages('Assets/AheadPagerTemplate_r2_c2servicesDown.gif','Assets/AheadPagerTemplate_r2_c3patientsDown.gif','Assets/AheadPagerTemplate_r2_c4contactDown.gif','Assets/AheadPagerTemplate_r2_c5loginDown.gif')">

<div id="container">
  <div id="header">
    <table border="0" align="left" cellpadding="0" cellspacing="0">
        <td height="0" colspan="3"><img src="Assets/AheadPagerTemplate_r1_c1.jpg" width="900" height="94" /></td>
        <td width="11" height="0" align="left" valign="top"><img src="Assets/AheadPagerTemplate_r2_c1.jpg" width="11" height="325" /></td>
        <td width="879" rowspan="2" align="left" valign="top" bgcolor="#FFFFFF"><table border="0" cellspacing="0" cellpadding="0">
            <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','Assets/AheadPagerTemplate_r2_c2servicesDown.gif',1)"><img src="Assets/AheadPagerTemplate_r2_c2servicesUP.gif" name="Image7" width="220" height="39" border="0" id="Image7" /></a></td>
            <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','Assets/AheadPagerTemplate_r2_c3patientsDown.gif',1)"><img src="Assets/AheadPagerTemplate_r2_c3patientsUp.gif" name="Image8" width="220" height="39" border="0" id="Image8" /></a></td>
            <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','Assets/AheadPagerTemplate_r2_c4contactDown.gif',1)"><img src="Assets/AheadPagerTemplate_r2_c4contactUp.gif" name="Image9" width="220" height="39" border="0" id="Image9" /></a></td>
            <td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','Assets/AheadPagerTemplate_r2_c5loginDown.gif',1)"><img src="Assets/AheadPagerTemplate_r2_c7loginUp.gif" name="Image10" width="220" height="39" border="0" id="Image10" /></a></td>
            <td colspan="4">&nbsp;</td>
        <td width="10" height="325"><img src="Assets/AheadPagerTemplate_r2_c3.jpg" width="10" height="325" /></td>
        <td width="0" height="0" align="left" valign="top"><img src="Assets/AheadPagerTemplate_r3_c1.jpg" width="11" border="0" /></td>
        <td><img src="Assets/AheadPagerTemplate_r3_c3.jpg" width="10" height="230" /></td>
        <td colspan="3"><p><img src="Assets/AheadPagerTemplate_r4_c1.jpg" width="900" height="51" align="top" /><span class="copyright">Copyright 2009 Ahead Imaging Center</span></p></td>
  <div id="mainContent"></div>
  <div id="footer">
    <!-- end #footer -->
<!-- end #container --></div>

Can't see the effect so can't really debug it, however here's a handful of observations:

  • Header table has attribute align="left" which is equivalent to a float, therefore maincontent div need style="clear:left;" (or clear:both; ) to force it (and subsequent markup) below the table.
  • Copyright statement looks like it should appear in the footer and not share a table cell with a 900px wide image.
  • Would <p>text</p> be better in its own table row?
  • I would think the whole thing could be done without tables.

Somewhere in that, your annoying gap may disappear. Good luck.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.