jasonc Posted August 29, 2009 Share Posted August 29, 2009 i am having trouble getting the text in the two center boxes positioned to the top. i have provided two versions of this table to show i have tried to use the valign and CSS but both seem not to work. how do i correctly get the text indicated in my code to be at the top of these TD's why also does some work and position correctly but the other two dont ? i know that using tables is not a good idea and a lot of these tags are said to be not valid but they still work ! <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <head> <style type="text/css"> <!-- td {vertical-align: top;} --> </style> </head> <body> <table width="1100"> <tr> <td width="296" rowspan="2" valign="top"> <div align="justify"><font color="#FFFFFF" size="2" face="Tahoma">text</font></div> </td> <td width="195" rowspan="2" align="center" valign="top"> <div><a href="?i=6" target="_top"><font color="#FFFFFF" size="2" face="Tahoma">text</font></a></div> <br> </td> <td colspan="2" align="right" valign="top"> <img border="0" align="top" width="450"></td> <td width="196" rowspan="2" valign="top"><a href="?c=ad" target="_blank"><font color="#0066FF">site</font></a><br><br> <acronym title=""><img width="120"> </acronym><br> <br> <img width="120"><br> <br><a href="?ac=ad" target="_blank"><font color="#0066FF">site</font></a></td> <tr> <td align="center" valign="top"><a href="?c=sub" target="_top"><font color="#FFFFFF" size="2" face="Tahoma">this should be at the top of this box</font></a></td> <td align="right" valign="top"> <div align="center"><a href="" target="_top"><font color="#FFFFFF" size="2" face="Tahoma">this should be at the top of this box</font></a></div> </td> </tr> </table> <table width="100%"> <tr> <td width="29%" rowspan="2" valign="top"> <div align="justify"><font color="#FFFFFF" size="2" face="Tahoma">text</font></div></td> <td width="17%" rowspan="2" align="center" valign="top"> <div><a href="?c=6" target="_top"><font color="#FFFFFF" size="2" face="Tahoma">text</font></a></div> </td> <td colspan="2" align="right" valign="top"> <img border="0" align="top" width="450"> </td> <td width="17%" rowspan="2" valign="top"> <a href="?c=ad" target="_blank"><font color="#0066FF">site</font></a><br><br> <acronym title=""><img width="120"> </acronym><br> <br> <img width="120"><br> <br><a href="?c=ad" target="_blank"><font color="#0066FF">text</font></a></td> </tr> <tr> <td width="20%" align="center" class="tdtop"><a href="?c=sub" target="_top"><font color="#FFFFFF" size="2" face="Tahoma">this should be at the top of this box</font></a></td> <td width="17%" align="center"> <a href="" target="_top"><font color="#FFFFFF" size="2" face="Tahoma">this should be at the top of this box</font></a> </td> </tr> </table> </body> </html> Quote Link to comment Share on other sites More sharing options...
Hybride Posted August 30, 2009 Share Posted August 30, 2009 As you noted, building a site with a table design is a big no-no. Here's a tutorial about it: CSS layouts. I would sincerely suggest you redo the layout you have into CSS style. It may be a pain to redo, but in the long run, it's much more clean, elegant and easy to fix. Also, your question "Why do some of them work" is kinda ambiguous: what do you mean they position correctly and other's don't? Which do and which don't? Quote Link to comment Share on other sites More sharing options...
jasonc Posted August 30, 2009 Author Share Posted August 30, 2009 the td's that are in their own columns show ok and have the text show at the top corrected code <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table width="100%"> <tr> <td width="29%" rowspan="2" valign="top"> <div align="justify"><font size="2" face="Tahoma">ok</font></div></td> <td width="17%" rowspan="2" align="center" valign="top"> <div><a href="?c=6" target="_top"><font size="2" face="Tahoma">ok</font></a></div> </td> <td colspan="2" align="right" valign="top">ok <img border="0" align="top" height="10" width="450"> </td> <td width="17%" rowspan="2" valign="top"> <a href="?c=ad" target="_blank">ok</a><br> <br> <img height="100" width="120"></td> </tr> <tr> <td width="20%" align="center" class="tdtop"><a href="?c=sub" target="_top"><font size="2" face="Tahoma">this should be at the top of this box</font></a></td> <td width="17%" align="center"> <a href="" target="_top"><font size="2" face="Tahoma">this should be at the top of this box</font></a> </td> </tr> </table> </body> </html> Quote Link to comment Share on other sites More sharing options...
haku Posted August 31, 2009 Share Posted August 31, 2009 Can you show us a screenshot of the problem? Quote Link to comment Share on other sites More sharing options...
jasonc Posted September 1, 2009 Author Share Posted September 1, 2009 i have put a border on the table to show that the text is shown at the top of all boxes but the two that have the text saying that this should have the text at the top [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
haku Posted September 2, 2009 Share Posted September 2, 2009 Try adding this to the top of your CSS: td { padding-top: 0; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.