0

What ways are there to try aligning the contents of a table cell? I have been requested to align a set of financial data so that the items are even on the screen and printout (that is, the decimals have to be on top of each other), but I cannot get the code to do what I want it to. Although I'm working in PHP, the segment I'm dealing with now is a simple echo of HTML table design code, with the only non-HTML data being the actual returned value.

I know there is an 'ALIGN=' command for use in table cells, but it doesn't seem to be working. I've tried every variation of 'ALIGN=RIGHT' that I can think of, and none of it seems to matter; the t able still left aligns the value anyway.

Can anyone offer any suggestions as to other ways to align the data in the cell?

Edit: Please ignore this message. This idiot (me) just discovered he's been trying to align the table from within the <FONT> tag instead of the <TD>tag. Sorry to waste anyone's time.

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by MidiMagic
0

I'd use CSS:

<td style="text-align:right;">£993535.00</td>

Edit:

Lol. I didn't read this far:

Edit: Please ignore this message. This idiot (me) just discovered he's been trying to align the table from within the <FONT> tag instead of the <TD>tag. Sorry to waste anyone's time.

I'd still use CSS. You could do this:

<style type="text/css">
td.currency{
  text-align:right;
}
</style>

...
<tr>
<td class="currency">£993535.00</td>
</tr><tr>
<td class="currency">£92464693535.00</td>
</tr><tr>
<td class="currency">£163573535.90</td>
</tr>
0

in the td tag, you can specify:

<td align="char">

If you don't also specify char="#" (where # is the character you choose), guess what character it uses to align the columns. The DECIMAL POINT! Just what you need.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.