There is no direct way to do this. HTML 4.01 has align=char
, but without browser support. CSS 2.0 had an analogue using the text-align
property with the same lack of support, so it was excluded from CSS 2.1. CSS3 templates have a good system for such alignment, but indicate that they can be cut from the specification if there are no (correct) implementations.
As a workaround, you can edit values with something invisible (empty) so that when the values are aligned to the right, the decimal markers are aligned. There are several ways to achieve this:
1) Use the number 0, but set the style on it, making it invisible, for example
123.4<span class=s>00</span>
from
.s { visibility: hidden; }
2) Use FIGURE SPACE U + 2007, which have the same width as the numbers (when the numbers have the same width), e.g.
123.4  
To do this, you need to set the font so that it contains U + 2007. According to http://www.fileformat.info/info/unicode/char/2007/fontsupport.htm even Arial contains it, but I'm afraid that it might not relate to older versions of Arial that are still in use.
3) Use the free space and set its width to the desired number of digits using the ch
block (specify the width of the digit 0), although this device is relatively new and is not supported by older browsers. Example:
123.4<span class=d2> </span>
from
.d2 { width: 2ch; display: inline-block; }
I would probably use the first method. Basically, the disadvantage is that when CSS is disabled, the data contains zeros, which implies incorrect accuracy information, while in other methods switching CSS only “spoils” the layout.
(It is probably obvious that the numbers should have the same width so that you can align the numerical data at all. This means that the font used for the values must have this property. Most fonts will do in this regard, but for example, Georgia, Constance and Corbel will not.)