0

I read (and tried):

  1. Break long word with CSS

And I now have:

<span style="font-size: xx-small; white-space: -moz-pre-wrap !important; white-space: -pre-wrap;white-space:
-o-pre-wrap;white-space: pre-wrap; word-wrap: break-word;word-break: break-all;white-space:normal;width: 385px;">

but still the large strings will NOT auto wrap in FF or IE but it DOES in Chrome...

(example: http://ed.je/2L6 or http://jsfiddle.net/92kSU/ )

Community
  • 1
  • 1
edelwater
  • 2,650
  • 8
  • 39
  • 67
  • 1
    Please share a JSFiddle – TylerH Mar 27 '14 at 17:35
  • What kinds of strings would you want to break and by which principles? For example, do you want norma l words t o be br oken at a ribra ry points? (Many “solutions” offered to abstract questions like this do such things.) – Jukka K. Korpela Mar 27 '14 at 18:50

2 Answers2

6

In this case it looks like you need to set word-break: break-all at a higher level. If I open your example page in Firefox and use Firebug to set style word-break: break-all on .entry-content then the large strings wrap.

Edit:

Alternatively, you could instead set the display style of you spans as inline-block.

dgvid
  • 26,293
  • 5
  • 40
  • 57
1

The following snippet is a catch-all for word-wrapping:

.class_name {
     -ms-word-break: break-all;
     word-break: break-all;

     /* Non standard for webkit */
     word-break: break-word;

     -webkit-hyphens: auto;
     -moz-hyphens: auto;
     -ms-hyphens: auto;
     hyphens: auto;
}

word-break: break-all will work except for IE8 and Firefox, so you need the ms-word-break prefixed line included as well. As usual, IE8 requires that its prefixed line be added first. This doesn't solve it for Firefox, however.

In FF, you need to use a new item called hyphenations, which is supported except for Chrome (but it's okay, because Chrome will use the basic word-break: break all) in this lengthy list: -webkit-hyphens: auto; -moz-hyphens: auto; -ms-hyphens: auto; hyphens: auto;.

Hyphenation will insert hyphens at the correct location for word-breaks, which is a better solution than just splitting a word in two.

More information on why this is a catch all.

Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
TylerH
  • 20,799
  • 66
  • 75
  • 101
  • 1
    Downvoter please comment; this is in fact a catch-all for word-wrapping and when applied to the OP's code will break the long strings. – TylerH Mar 27 '14 at 17:45
  • tnx would also work. gave you an upvote to match to whoever downvoted – edelwater Mar 27 '14 at 17:48