Last night I received a real brain twister of a question from @ganarce on my Twitter page. He wanted to know if there was a way to align data within a table using a decimal point “.”. Seemed like a fairly routine type of formatting (invoices, data etc.). Without massaging the data ahead of time to all have the same number of characters before or after the decimal point.

Aligning data with a decimal point

I went to the W3C to for an explanation on horizontal alignment. Ah ha! there it was. Easy enough:

col align=”char” char=”.”

Unfortunately there is little or no support for this attribute amongst the Browser community. I found a method using JQuery that seems to work with IE, FF and Chrome.

Happy formatting!