Why Firefox is breaking word from /
(slash) and -
(hyphen) into lines.
Example with /
and -
table {
width: 100%;
}
<table>
<tbody>
<tr>
<td>
LoremipsumdolorsitametconsecteturadipisicingelitLaboredistinctionamdoloresmodiamet/etblanditiisarchitectsundolorem/qnullobcaecatnobilibermollitia/sialiquiodiomagncommodi.
</td>
</tr>
</tbody>
</table>
Example without /
and -
table {
width: 100%;
}
<table>
<tbody>
<tr>
<td>
LoremipsumdolorsitametconsecteturadipisicingelitLaboredistinctionamdoloresmodiametetblanditiisarchitectsundoloremqnullobcaecatnobilibermollitiasialiquiodiomagncommodi.
</td>
</tr>
</tbody>
</table>
Both Examples are working good in other browsers, I have tried overflow-wrap
but didn't work.
I'm using Firefox 67.0 (64-bit)
.
Please open it in Firefox.
Looks as Mozilla is considering /
and -
as whitespace delimiters. After a small research I suggest escaping /
and -
with its html equivalent code, before emitting it to the table.
UPDATE
Found another pure CSS solution that works in mozilla too
table {
width: 100%;
}
table td {
word-break: keep-all;
}
<table>
<tbody>
<tr>
<td>
LoremipsumdolorsitametconsecteturadipisicingelitLaboredistinctionamdoloresmodiamet/etblanditiisarchitectsundolorem/qnullobcaecatnobilibermollitia/sialiquiodiomagncommodi.
</td>
</tr>
</tbody>
</table>
Here is a small JS Snippet that escapes /
and -
to its equivalent html code.
var str = 'Loremipsumdolorsitametconsectetura-dipisicingelitLaboredistinctionamdol-oresmodiamet/etblanditiisarchitectsundolorem/qnullobcaecatnobilibermollitia/sialiquiodiomagncommodi.';
const escaped = str.replace(/\//g, '/').replace(/-/g, '-');
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