Page 1 of 1

Table cell height attributes in IE

Posted: Fri Mar 26, 2004 1:13 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:22 pm
by Chambrln
Try making one of your cells height = 100%. Make it the one that has most of your content or the one that you want to have most of the white space.

That should increase your table to the full 95% height overall you are trying to achieve.

Posted: Fri Mar 26, 2004 1:28 pm
by Chris Corbyn
Its not just the height I'm struggling with. My menu on the left hand side (fixed width of 220 pixels) does not fit the same 220 pixel width in IE and navigator. For this reason the text is shifted onto more lines causing the entire table to stretch in height.

The cell with my logo in it (nitrotones.tk) seems to constantly change size depending on which page is being viewed too even though it is set at fixed height 60 pixels and the content in that cell never changes (i've not forgotten I have used cell padding of 15 px).

I'll try out setting some cells to 100% width/height although I don't get how a fixed width/heght cell should ever change size unless the content is too much.

Thanks :)

Posted: Fri Mar 26, 2004 2:15 pm
by Chris Corbyn
I've sorted it.

I never used to think that this attribute was entirely neccassary but it obviously is.

All of my height attributes and width attributes were interpreted for each cell only once I added rows=3 and cols=3 to the <table> tag.

Thanks for your help anyway. Much appreciated :-)

Posted: Fri Mar 26, 2004 2:40 pm
by patrikG
d11wtq, don't double-post. Thank you.

Posted: Fri Mar 26, 2004 3:04 pm
by Chris Corbyn
Sorry,

I realised i posted in the database forum when I meant to post in the PHP forum