Search code examples
htmlfirefoxinternet-explorer-7

HTML Table columns height; Works in Firefox not in IE


I have some HTML that displays fine on FireFox3/Opera/Safari but not with IE7. The snippet is as follows:

<!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">
<head></head>
    <body bgcolor="#AA5566" >
    <table width="100%">

      <tr>

        <td height="37" valign="top"><img style="float:right;" border="0" src="foo.png" width="37" height="37"/></td>

        <td width="600" rowspan="2" >
          <table width="600" height="800"><tr><td><img src="bar.jpg" width="600" height="800"/></td></tr></table>
        </td>

        <td height="37" valign="top"><img style="float:left;" border="0" src="foo.png" width="37" height="37"/></td>

      </tr>

      <!-- This row doesnt fill the vertical space on IE7 //-->
      <tr>
        <td valign="top" bgcolor="#112233">&nbsp;</td>
        <td valign="top" bgcolor="#112233">&nbsp;</td>
      </tr>

    </table>
    </body>

The second row wont fill the vertical space created by the first rows middle column (notice the rowspan="2") correctly. Instead the first rows 1st and 3rd columns expand down even though I set their height to 37. The image below shows what happens in IE7 and Firefox3...

alt text

EDIT: added the HTML doc type to the code snippit. Added a screenshot.

Any help appreciated, thanks :)


Solution

  • What if you try it like this:

    <!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">
    <head></head>
        <body bgcolor="#AA5566" >
        <table width="100%" border='1'>
    
          <tr>
    
            <td valign="top">
                <table bgcolor="#112233" height="37" width='100%'><tr><td>asdf</td></tr></table><br />
                Other content
            </td>
    
            <td width="600" rowspan="2" >
              <table width="600" height="800"><tr><td>asdf</td></tr></table>
            </td>
    
            <td valign="top">
                <table bgcolor="#112233" height="37" width='100%'><tr><td>asdf</td></tr></table><br />
                Other content
            </td>
    
          </tr>
    
    
    
        </table>
        </body>