BlueChippy BlueChippy - 1 month ago 10
HTML Question

Stop html table cell breaking on minus sign and instead on decimal point?

Is it possible to stop a TD breaking on the minus sign of a value and instead make it break on the decimal point?

I have a table displaying decimal amounts from a database. Some of the amounts are large and need to wrap somehow.

At the moment, when a value exceeds my TD's width it get truncated as follows:

-
123456.00


But Is there any way to make it break as:

-12345
.00


without having to manually intervene and format the strings? i.e. can it be done in css or another way?

EDIT

Both of these work in Firefox, but not in IE8 (second and third columns are

<td>
-1234567&#8203;.89
</td>
<td>
-1234567<wbr>.89
</td>


enter image description here

Answer

Try using the <wbr> tag like so:

-123456<wbr>.00

To make it more browser compatible you can use this too: (ref)

&#8203;
Comments