johnjohn
johnjohn

Reputation: 4281

word-wrap:break-word alternative?

I can't make it work on FF and Chrome while it plays well on IE/Opera. I there a way to do it, even with Javascript/JQuery?

Thank you.

Upvotes: 1

Views: 2287

Answers (2)

sdleihssirhc
sdleihssirhc

Reputation: 42496

For more control over where, you can use an HTML element.

Upvotes: 1

Dan8080
Dan8080

Reputation: 66

That's a CSS attribute.

I found this solution posted elsewhere, but haven't tried it.

.wrapword{ 
    white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */ 
    white-space: -pre-wrap;      /* Opera 4-6 */ 
    white-space: -o-pre-wrap;    /* Opera 7 */ 
    white-space: pre-wrap;       /* css-3 */ 
    word-wrap: break-word;       /* Internet Explorer 5.5+ */ 
}

If FF has trouble breaking a word when doing wrapping, a sure way to force it is to have a function that breaks up words over a certain length, inserting a character that ffox will break on. You can do a browser check to only do that on browsers that need it.

Upvotes: 3

Related Questions