Table cell height attributes in IE

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Table cell height attributes in IE

Post 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
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post 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">
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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 :)
Post Reply