Hi, My table not good in Internet Explorer, is align left and not work link. In Firefox is good, is align center and link work good. Why not work good in browser Internet Explorer? Why I mistake? Someone can help me? <TABLE cellSpacing=0 cellPadding=0 width=173 height="180" align=center border=1> <TBODY> <TR> <TD> <div align="center"><br /> <table bgcolor="#FF8C00" cellSpacing="0" cellPadding="0" width="160" height="180" align="center"> <tr><td width="100"> <table bgcolor="#CCCCCC" align="center" style="height:auto"> <tr><td bgcolor="#FF8C00" height="5" width="148"></td></tr> <tr><td height="5" width="148"><div align="center"> <a href="1.php"> <? echo "<table>"; echo "<tr bgcolor='#FF8C00'>"; echo "<td>" . date('F d, Y', time() - 86400) . "</td>"; echo "</tr>"; echo "</table>"; ?></a></div></td></tr> <tr><td bgcolor="#FF8C00" width="143" style="height:auto"><div align="center"> <a href="2.php"> <? echo "<table>"; echo "<tr bgcolor='#CCCCCC'>"; echo "<td>" . date('F d, Y', time() - 172800) . "</td>"; echo "</tr>"; echo "</table>"; ?></a></div></td></tr> <tr><td height="5" width="148"><div align="center"> <a href="3.php"> <? echo "<table>"; echo "<tr bgcolor='#FF8C00'>"; echo "<td>" . date('F d, Y', time() - 259200) . "</td>"; echo "</tr>"; echo "</table>"; ?></a></div></td></tr> <tr><td bgcolor="#FF8C00" width="143" style="height:auto"><div align="center"> <a href="4.php"> <? echo "<table>"; echo "<tr bgcolor='#CCCCCC'>"; echo "<td>" . date('F d, Y', time() - 345600) . "</td>"; echo "</tr>"; echo "</table>"; ?></a></div></td></tr> <tr><td height="5" width="148"><div align="center"> <a href="5.php"> <? echo "<table>"; echo "<tr bgcolor='#FF8C00'>"; echo "<td>" . date('F d, Y', time() - 432000) . "</td>"; echo "</tr>"; echo "</table>"; ?></a></div></td></tr> <tr><td bgcolor="#FF8C00" width="143" style="height:auto"><div align="center"> <a href="6.php"> <? echo "<table>"; echo "<tr bgcolor='#CCCCCC'>"; echo "<td>" . date('F d, Y', time() - 518400) . "</td>"; echo "</tr>"; echo "</table>"; ?></a></div></td></tr> <tr><td height="5" width="148"><div align="center"> <a href="7.php"> <? echo "<table>"; echo "<tr bgcolor='#FF8C00'>"; echo "<td>" . date('F d, Y', time() - 604800) . "</td>"; echo "</tr>"; echo "</table>"; ?></a></div></td></tr> <tr><td bgcolor="#FF8C00" width="143" height="5"><div align="center"> <a href="8.php"> <? echo "<table>"; echo "<tr bgcolor='#CCCCCC'>"; echo "<td>" . date('F d, Y', time() - 691200) . "</td>"; echo "</tr>"; echo "</table>"; ?></a></div></td></tr> <tr><td height="5" width="148"><div align="center"> <a href="9.php"> <? echo "<table>"; echo "<tr bgcolor='#FF8C00'>"; echo "<td>" . date('F d, Y', time() - 777600) . "</td>"; echo "</tr>"; echo "</table>"; ?></a></div></td></tr> <tr><td bgcolor="#FF8C00" width="143" height="5"><div align="center"> <a href="10.php"> <? echo "<table>"; echo "<tr bgcolor='#CCCCCC'>"; echo "<td>" . date('F d, Y', time() - 864000) . "</td>"; echo "</tr>"; echo "</table>"; ?></a></div></td></tr> </table> </td></tr> </table><br /> </div></TD></TR></TBODY></TABLE> Code (markup): Thanks in advance, george
My first guess would be "totally messed up coding". Now - does it have to look exactly like that? Or would it be just as well if you had one table with a centered link within each row containing the date (with differing colors for each row)?
Here you go, this does exactly the same as your code (apart from adding all the extra tables etc.) and it is completely valid XHTML / CSS-based. It is also a wee bit shorter. I didn't bother using the same colors, but you can just exchange the color-values as you please. <div style="text-align: center;"> <table style="border: 1px solid black; width: 173px; height: 180px; text-align: center; margin: 0 auto;"> <tbody> <?php $links = array('1.php','2.php','3.php','4.php','5.php','6.php','7.php','8.php','9.php','10.php'); $num = count($links); for($i=0;$i<$num;$i++){ // if row number is even use first color, if it is odd use the second if($i % 2 ==0) { $bgcolor='#999'; } else { $bgcolor='#777'; } // output the table row with the correct background color ?> <tr style="background: <?php echo $bgcolor; ?>"> <td> <a href="<?php echo $item; ?>"> <?php echo date('F d, Y', time() - (86400 * $i)); ?></a> </td> </tr> <?php } ?> </table> </div> PHP: If this helps, I'd appreciate a rep-point added
Oh, I'm sorry - I edited my original suggestion, and a couple of lines got messed up - here's the corrected code: <div style="text-align: center;"> <table style="border: 1px solid black; width: 173px; height: 180px; text-align: center; margin: 0 auto;"> <tbody> <?php $links = array('1.php','2.php','3.php','4.php','5.php','6.php','7.php','8.php','9.php','10.php'); $num = count($links); $i=0; while(list(, $item) = each($links)){ // if row number is even use first color, if it is odd use the second if($i % 2 ==0) { $bgcolor='#999'; } else { $bgcolor='#777'; } // output the table row with the correct background color ?> <tr style="background: <?php echo $bgcolor; ?>"> <td> <a href="<?php echo $item; ?>"> <?php echo date('F d, Y', time() - (86400 * $i)); ?></a> </td> </tr> <?php $i++; } ?> </table> </div> PHP: retested, and works (You can see a test here: http://www.regncon.no/tabletest.php )