adv banner
HTML and CSS  Home HTML and CSS Tutorials Every time I try to list numbers in columns with text, I can't get the decmal points to line up. What gives?
rss

Every time I try to list numbers in columns with text, I can't get the decmal points to line up. What gives?

Author: Jeff Singer More by this author
Browse Pages: << <  2  3  4  5  6 > >>


Actually, there are two solutions to this problem. One is to use the <PRE> tags for presenting preformatted text. The problem with this solution is that the text you are presenting must be properly aligned. If it is not- here is how to solve your problem very easily using tables.

Example

In the example I am using borders so you can see what is doing. If you do not want border, just remove the BORDER= attribute. It is best not to set it equal to 0 as some browsers may just see the BORDER attribute and put one there anyway.

Account Catagory January February
Cash on Hand $15,123.45 $20,123.45
Stocks and Bonds $5,233.00 $454.42
Inventory $155,212.00 $65,111.02

Source code

<TABLE WIDTH=400 BORDER=1>
 <TR>
  <TH ALIGN=LEFT>Account Catagory</TH>
  <TH ALIGN=RIGHT>January</TH>

  <TH ALIGN=RIGHT>February</TH>
 </TR>
 <TR>
  <TD ALIGN=LEFT>Cash on Hand</TD>
  <TD ALIGN=RIGHT>$15,123.45</TD>

  <TD ALIGN=RIGHT>$20,123.45</TD>
 </TR>
 <TR>
  <TD ALIGN=LEFT>Stocks and Bonds</TD>
  <TD ALIGN=RIGHT>$5,233.00</TD>

  <TD ALIGN=RIGHT>$454.42</TD>
 </TR>
 <TR>
  <TD ALIGN=LEFT>Inventory</TD>
  <TD ALIGN=RIGHT>$155,212.00</TD>

  <TD ALIGN=RIGHT>$65,111.02</TD>
 </TR>
</TABLE>

See Also:



print this page tell a friend subscribe to newsletter subscribe to rss
Rate this Material: Bad 1 2 3 4 5 Excellent
Browse Pages: << <  2  3  4  5  6 > >>

Add comments to "Every time I try to list numbers in columns with text, I can't get the decmal points to line up. What gives?"