tags:

views:

92

answers:

5

I've used:

word-break:break-all;
table-layout:fixed

and the text wraps in Chrome but not Firefox.

Update: I decided to change the design so it didn't need the wrap; trying to sort out a CSS fix/hack was proving too frustrating and time consuming.

+1  A: 

Set a column witdh for td tag.

Black Frog
+1  A: 

Use CSS3 word-wrap: break-word;. Works in WebKit based browsers (Safari, Chrome) as well.

Update: I forgot, the element in question must however be either implicitly or explicitly positioned as fixed element or displayed as block element. For table cells (td), use display: inline-block;.

BalusC
Tried this too, but didn't work for me in firefox 3.6.6
swisstony
I tried both (separately), but unfortunately they messed up the table formatting quite badly.
swisstony
My bad, use `display: inline-block;`.
BalusC
Still messes the table's formatting up badly.
swisstony
A: 

One slightly hackish way of doing this is by processing the text to add space between each letter. Replace spaces with   Then use the letter-spacing css attribute to bring the spaces down.

I know, it's a hack... but if NOTHING else works, it should wrap without problem.

Atømix
A: 

You can manually inject zero width spaces (​) to create break points.

kingjeffrey
There is also a non-standard HTML tag `<wbr>` [for "word break"]. Here is the browser support for this and the `​` solution: http://www.quirksmode.org/oddsandends/wbr.html
kingjeffrey
A: 

I think this is a long standing issue in Firefox, that harks back to Mozilla and Netscape. I'll bet you were having the issue with the display of long URLs. I think it is an issue with the rendering engine rather than something you can fix with CSS, without some ugly hacks.

Makes sense to change the design.

This looked hopeful though: http://hacks.mozilla.org/2009/06/word-wrap/

dunxd