5

Is it possible to format numbers using css ?

When I have 7000000.00, I would like it displayed as 7 000 000.00

I know I could write a backend (php, perl...) function or a javascript function that could return the formatted number but...

The numbers that I want to format are into a cell. I would like to have something like

<td class="myformat">7000000.00</td>
or
<td><span class="myformat">7000000.00<span></td>

6

Currently CSS does not format numbers in the way you are hoping although it does look like it's being discussed. For now you're best bet is to stick with server-side formatting. You could do it with JavaScript but that wouldn't be as reliable as server side technologies since users can turn it off.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.