I want a table containing a column of decimal numbers with different lengths before and after the decimal point, and with the decimal points all aligned.
Column widths must be of a "flowing" size, expanding as necessary to accommodate very long numbers in any data cells, or very long headers associated with the column.
Cells containing integers (without decimal points) should still display numbers, with the numbers aligned in the same position as if a decimal character were present. (For example, the number 512 should still align correctly with a cell that only contains "512" instead of "512".)
Font should be irrelevant; monospaced should not be required.
Finally, the numbers must also be centered in the column as much as possible while keeping the decimal points (visible and implicit!) aligned. Specifically, the width of the "left white space" of the cell with the most characters before the decimal character (or simply the majority of characters if no decimal character is present) must be equal to the width of the "right white space" of the cell The width is the same. The cell with the most characters after the first decimal character.
For the final requirement, I specifically said "characters" rather than "numbers" because the table layout should handle symbolic characters such as plus/minus signs in front of numbers, and letters such as measurement unit abbreviations appended after numbers.
The HTML 4.01 specification "by definition" allows such layouts to be easily accomplished using simple HTML tables. (Split the data by decimal character into two inner cells of a 4-column colgroup, with the outer two colswidth="*"and the inner two colswidth="0*". Right-align the cells containing the integer part of the number, and left-align the cells containing the decimal and decimal parts of the number. Set these two cells tonowrap, and then set the # of the table ##cellpadding="0" cellspacing="0" rule="group".)
There is a pure html/css solution, but it's not pretty. You need to split the decimal aligned column into two columns with no padding between them. The first column has integer values and is right justified, the second column has decimal and fractional values.
You can also use classes like ".integer" and ".decimal" instead of the :nth-child selector. This would be more robust, but I'm trying to keep the markup short.