Page 1 of 1

Table cell height attributes in IE

Posted: Fri Mar 26, 2004 1:20 pm
by Chris Corbyn
Hi,

I'm having a bit of compatability prob with IE. I've constructed a site in tables with PHP which all works fine in Netscape. Some of my cells have specified sizes (some in % and others in fixed pixels).

Internet explorer seems to not understand the dimensions I am putting in and ignores them whereas netscape handles it fine.

I'm typically doing this

Code: Select all

echo '<table border="0" cellpadding="15" cellspacing="0" align="center" Width="100%" height="95%">'; 
echo '<tr>'; 
   echo '<td rowspan="3" bgcolor="#91C4F2" valign="top" width="220">'; 
      include('navbar.html'); 
   echo '</td>'; 
   echo '<td colspan="3" height="60" align="center" bgcolor="#2B53C5">'; 
      include ('logo.html'); 
   echo '</td>'; 
echo '</tr>'; 
echo '<tr>'; 
   echo '<td colspan="3" height="60" bgcolor=#D6E9FD valign="top">'; 
switch ($location) &#123; 
   case 'index': 
      include ('default.php'); 
   break; 
                &#125; 
   echo '</td>'; 
echo '</tr>'; 
echo '<tr>'; 
   echo '<td width="35%" bgcolor=#D6E9FD valign="top">'; 
switch ($location) &#123; 
   case 'index': 
      include ('mainleft.html'); 
   break; 
                &#125; 
   echo '</td>'; 
   echo '<td bgcolor=#D6E9FD>'; 
   switch ($location) &#123; 
   case 'nok_a': 
      include ('img/codeloader.php'); 
   break; 
                &#125; 
   echo '</td>'; 
echo '</tr>'; 
echo '</table>';
Any idea why explorer is ignoring my width and height attributes?

You can check it in both browsers at http://nitrotones.tk
if you want to see what I mean.

Thanks

Posted: Fri Mar 26, 2004 1:35 pm
by TheBentinel.com
The width and height attributes in tables don't get as much respect as their equivalent style attributes. You might try those and see if you have more success:
e.g., <td style="height: 25px; width: 50px">

Posted: Fri Mar 26, 2004 2:18 pm
by Chris Corbyn
Good idea. Never thought of doing that in table cells.

I discovered that when you add rows=3 and cols=3 to the <table> tag my size attributes were interpreted anyway but I will remember your idea of using style attributes in future.

Thanks alot :)