Forum Moderators: open

Message Too Old, No Replies

Table cell alignment in IE7

         

salamano

10:30 am on Dec 1, 2006 (gmt 0)

10+ Year Member



Hi,

I have a problem with displaying table cells correctly in ie7 - works in Firefox. I have a row with three cells - left cell is fixed width, right cell is fixed width and middle has no width, so that it should stretch with browser resolution to allow left and right cells to display at left and right of browser. However, in ie7 the right cell does not display at right - in other words, middle cell does not stretch. Code of table (top row is the problem) is:

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="500" height="106" id="logo">&nbsp;</td>
<td class="header">&nbsp;</td>
<td width="260" align="right" class="header"><script type="text/javascript" src="slide.js"></script></td>
</tr>
<tr>
<td height="34" id="topleft">&nbsp;</td>
<td colspan="2" align="center" valign="middle">
<p class="date">Welcome to The Old Mill on
<script type="text/javascript" src="date.js"></script> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
</td>
</tr>
</table>

In css file the relevant info is:

body {background:#ECE9D8; margin:0px;}

.header {background-image:url("images/header-bg.jpg"); background-repeat:repeat-x;}

#topleft {background-image:url("images/top-left.gif"); background-repeat:no-repeat;}

The two scripts are simple slideshow and display date scripts.

Is there some simple error here that I'm missing? Can't figure out why middle cell won't stretch!

salamano

2:45 pm on Dec 1, 2006 (gmt 0)

10+ Year Member



Never mind - I fixed it myself, by simplifying the table and noticing that the middle cell actually was pointless - just removed it and used two cells and aligned right ... Basics! Simple solution after all :)

Still don't understand why the first version doesn't work, though.

Solution code:

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="500" height="106" id="logo">&nbsp;</td>
<td align="right" class="header"><script type="text/javascript" src="slide.js"></script></td>
</tr>
<tr>
<td height="34" id="topleft">&nbsp;</td>
<td align="center" valign="middle">
<p class="date">Welcome to The Old Mill on
<script type="text/javascript" src="date.js"></script> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
</td>
</tr>
</table>