html - how to vertically align table data -


i have following table alignment goes wrong because of values have brackets in them. build data in c# although table rendered using html. have jquery available. there way correct alignment in either of these languages please?

| value  | | 40%    | | 20%    | | (30%)  | | 10%    | 

notice how 30% not aligned correct because of brackets.

thanks, james

as building data on server-side (c#), (and being numbers better off right-aligned) append space before sending data down client.

(1) convert data string. if brackets because of being negative append space positive numbers while converting string. if brackets there after conversion string (result of format), append space string values not ending ")".

for example: while formatting numbers:

string myformat = "#0% ;(#0%)"; myvalue.tostring(myformat); 

notice space after positive part (first part) of format.

for example: if data string:

if (! stringvalue.substring(stringvalue.length - 1) == ")") {     stringvalue += " "; } 

now have space padding on data positive numbers (or non-bracketed strings).

(2) once data brought client, specify css text-align:right table cells. however, if font proportionate not line up. specify monospace font these cells (or column). e.g. font-family: courier new; have found out font-family: verdana; line numbers if monospaced.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -