I want to align positive numbers and negative numbers enclosed in parentheses using CSS to achieve the following result:
431,000
(26,000)
94,000
(57,000)
Using text-align:right;
on table cells returns the following result instead:
431,000
(26,000)
94,000
(57,000)
But this is imperfect.
Is there an easy way to do this in such a way that parentheses have not effect on the alignment.
I want to align the numbers so that commas are on top of each other.
Thanks!!
Whatever language you choose, you need to test your string output to see if they are negative or positive. Add the brackets to the negatives and add a
to the end of your positives and still use your text-align: right; Use this if you are using a font where all characters are the exact width like a typewriter.
or add this for a perfect fit otherwise.
<span style="visibility: hidden;">)</span>
after, this is most likely better anyways.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With