Jump to content

TimString

Recommended Posts

I have a simple php table of two columns. The left column is aligned right, and the second one is aligned left. For some reason or another, I can't post a screen shot. How do I get the space between those two columns aligned with the center of the page?

 

 

 

Here's the code for the first row:

 echo "<table border = 0 width = 100%";
 echo "<tr>";
 echo "<td style='text-align:right; padding:3px 3px 0px 3px; Border:2px; font:15px Arial, sans-serif'>System:</td>"; //top right bottom left
 echo "<td style='text-align:left; padding:3px 3px 0px 3px; font:15px Arial, sans-serif'>" . $System . "</td>";
 echo "</tr>";
Link to comment
Share on other sites

You can set each td to have a width of 50%.

 

However if this is not tabular data, you should be using divs and CSS to format it.

And fix your HTML. You never even closed the table tag, and you need to quote your attributes.

Edited by Jessica
Link to comment
Share on other sites

<br /><table border = 0 width = 100%<tr><td style='text-align:right; padding:3px 3px 0px 3px; Border:2px; font:15px Arial, sans-serif'>System:</td><td style='text-align:left; padding:3px 3px 0px 3px; font:15px Arial, sans-serif'>Bryan, TX</td></tr><tr><td style='text-align:right; padding:3px 3px 0px 3px; Border:2px; font:15px Arial, sans-serif'>Display Channel:</td><td style='text-align:left; padding:3px 3px 0px 3px; font:15px Arial, sans-serif'>69</td></tr><tr><td style='text-align:right; padding:3px 3px 0px 3px; Border:2px; font:15px Arial, sans-serif'>Station:</td><td style='text-align:left; padding:3px 3px 0px 0px; font:15px Arial, sans-serif'>Inspirational (Digital Only)</td></tr><tr><td style='text-align:right; padding:3px 3px 0px 3px; font:15px Arial, sans-serif'>EIA Channel:</td><td style='text-align:left; padding:3px 3px 0px 0px; font:15px Arial, sans-serif'>75</td></tr><tr><td style='text-align:right; padding:3px 3px 0px 3px; font:15px Arial, sans-serif'>Frequency:</td><td style='text-align:left; padding:3px 3px 0px 0px; font:15px Arial, sans-serif'>531 MHz</td></tr></table><br /><table style='border-collapse:collapse; font:15px Arial, sans-serif'; width='100%' border='3'><CAPTION>Stations on Digital Rail 75</CAPTION><tr><th style='font-size:1em; font:15px Arial, sans-serif'; width = '80%'>Station</th><th style='font-size:.85em; font:15px Arial, sans-serif';width = '20%'> Display <br /> Channel</th></tr><tr bgcolor='#A9F5A9'><td style='text-align:left; padding:3px 0px 3px 12px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>Bravo</td><td style='text-align:right; padding:3px 12px 3px 0px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>63</td></tr><tr bgcolor='#FFFFFF'><td style='text-align:left; padding:3px 0px 3px 12px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>MSNBC</td><td style='text-align:right; padding:3px 12px 3px 0px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>64</td></tr><tr bgcolor='#A9F5A9'><td style='text-align:left; padding:3px 0px 3px 12px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>CMT</td><td style='text-align:right; padding:3px 12px 3px 0px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>65</td></tr><tr bgcolor='#FFFFFF'><td style='text-align:left; padding:3px 0px 3px 12px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>GAC</td><td style='text-align:right; padding:3px 12px 3px 0px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>66</td></tr><tr bgcolor='#A9F5A9'><td style='text-align:left; padding:3px 0px 3px 12px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>CSPAN2</td><td style='text-align:right; padding:3px 12px 3px 0px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>67</td></tr><tr bgcolor='#FFFFFF'><td style='text-align:left; padding:3px 0px 3px 12px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>TBN</td><td style='text-align:right; padding:3px 12px 3px 0px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>68</td></tr><tr bgcolor='#A9F5A9'><td style='text-align:left; padding:3px 0px 3px 12px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>Inspirational (Digital Only)</td><td style='text-align:right; padding:3px 12px 3px 0px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>69</td></tr><tr bgcolor='#FFFFFF'><td style='text-align:left; padding:3px 0px 3px 12px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>LMN</td><td style='text-align:right; padding:3px 12px 3px 0px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>70</td></tr><tr bgcolor='#A9F5A9'><td style='text-align:left; padding:3px 0px 3px 12px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>Jewelry (Digital Only)</td><td style='text-align:right; padding:3px 12px 3px 0px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>71</td></tr><tr bgcolor='#FFFFFF'><td style='text-align:left; padding:3px 0px 3px 12px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>EWTN (Digital Only)</td><td style='text-align:right; padding:3px 12px 3px 0px; border-collapse:collapse; font:15px Arial, sans-serif'; border = '3'>72</td></tr></table>
<html>

 

As I told you, your table tag is not closed, and you need to quote the attributes.

 

You also did NOT add any 50%.

 

Make the first two <td>s into <th> and put style="width: 50%" on them.

Edited by Jessica
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.