One common issue I face is working with tables that contain numbers requiring right alignment to ensure the ones/tens/hundreds/thousands places line up correctly. Here's an example:
2,343
1,000,000
43
43,394
232,111
In these tables, column headers are typically centered. However, when the table columns are wide, it can result in a less appealing layout:
Column 1 Column 2
===========================|===========================
2,343 | 32
43 | 44,432
12,243,394 | 23
232,111 | 4,432
I'm wondering if there's a way, perhaps using JavaScript, jQuery, or CSS, to center the numbers based on the widest number while retaining the right justification. The desired appearance would look like this:
Column 1 Column 2
===========================|===========================
2,343 | 32
43 | 44,432
12,243,394 | 23
232,111 | 4,432
Instead of setting td padding globally, I am seeking a more dynamic solution that can adapt to various tables with different column and number widths. Is this achievable?