This post is from Les Orchard, who works on Mozilla’s web development team.
Web browsers have a long history of sharing features between them. The word-wrap CSS property is a feature that originally came from Microsoft and is included in CSS3.
Now available in Firefox 3.5, this CSS property allows the browser to arbitrarily break up long words or strings of characters to fit within a given element.
How is this helpful? Well, have you ever had to display an extremely long URL or block of data on a page? Sure, URL shortening services have helped, but the basic layout issue still remained.
Consider the following URL using the data scheme:
Presented in a <textarea>, this huge URL behaves well enough to at least not break the layout of this page. But, it’s not really handled all that gracefully beyond that. Most browsers don’t quite know what to do with the scrollbar, styling is a pain, and presenting the URL in an editable field isn’t really the intent here.
Alternatively, you could stuff the URL into a <div> and slap an overflow: hidden style on it, like so:
Again, the page layout isn’t broken, but now the URL is cut off. So, why not try an overflow: auto style instead?
This will give you a scrollbar, at least:
But now, visitors to your page have to scroll to see the whole
thing, and highlighting the text for copy & paste can be
cumbersome.
So, finally, here’s the word-wrap: break-word payoff:
See the difference for yourself: Use the radio buttons above to switch between the values normal (the default) and break-word. The normal value will cause the URL to spill out of the containing <div>, possibly breaking the layout of this page.
On the other hand, using word-wrap: break-word will allow the browser to coerce the text into the confines of the <div>, thus preserving your page layout and quite possibly your sanity.


Niiice.
Now we need its cousin to be implemented too — “text-overflow: ellipsis”:
https://bugzilla.mozilla.org/show_bug.cgi?id=312156
…For Firefox 3.6?
If this is one word, shoould it be behaving as one by double clicking on it?
Sure it should behave as one word (and it does, right?).
@Andy
I agree. Even IE does text-overflow: ellipsis! That’s probably the only CSS hack I use that most browsers EXCEPT Firefox support.
“Presented in a , this huge URL behaves well enough to at least not break the layout of this page. But, it’s not really handled all that gracefully beyond that.”
http://www.gerv.net/temp/layout-broken.png
Hmm. Somewhat unexpected and non-usable behaviour of this comment system with regard to tags. If there’s no note saying otherwise next to a comment form, one would expect them to be escaped rather than silently stripped. Let me try again:
“Presented in a <textarea>, this huge URL behaves well enough to at least not break the layout of this page. But, it’s not really handled all that gracefully beyond that.”
<cough>
http://www.gerv.net/temp/layout-broken.png
(Firefox 3.5 pretty-much-final, Linux Ubuntu 9.04)
You might want to note that most of the examples won’t display properly in a feed such as Planet Mozilla.
http://culturefeed.org/node/2195 money order hydrocodone begin http://community.rv.net/_Xanax-Buy-Online/blog/699768/43507.html xanax online no script bases http://www.antlr.org/wiki/display/~propecia4gt cod propecia NewAdvancedPoll http://community.bonnaroo.com/_Tramadol-Buy-Online/blog/699831/12058.html tramadol dosage for canines numbermy http://rifers.org/wiki/display/~tramadol4g5j cheap tramadol overnight Griffin http://community.bonnaroo.com/_Soma-Buy-Online/blog/699835/12058.html online pharmacy soma Controller http://culturefeed.org/node/2194 prescription of ativan Alamat http://www.antlr.org/wiki/display/~ambien46gf overnight ambien Whether http://culturefeed.org/node/2191 medicine ultram themselves http://community.rv.net/_Ultram-Buy-Online/blog/699779/43507.html buy ultram next day delivery costa http://www.antlr.org/wiki/display/~tramadol78yg tramadol er record http://rifers.org/wiki/display/~soma4t5 soma cod no prescription Academy http://community.bonnaroo.com/_Phentermine-Buy-Online/blog/699833/12058.html phentermine free consultation includ http://culturefeed.org/node/2190 buy valium from online pharmacy with saturday delivery dibawahnya http://community.rv.net/_Viagra-Buy-Online/blog/699770/43507.html viagra fedex overnight vertically http://culturefeed.org/node/2196 expired vicodin egarciaccad
http://community.rv.net/_Tramadol-Buy-Online/blog/699809/43507.html buy tramadol.com brown http://community.bonnaroo.com/_Accutane-Buy-Online/blog/699860/12058.html online sales Accutane excel http://www.antlr.org/wiki/display/~clonazepam2g7h buy Clonazepam online cheap Workshop http://my.wsbtv.com/_Buy-Ambien-Order-Online/blog/712638/6690.html ambien shipped overnight CMR1954aol http://culturefeed.org/node/2207 nexium without a prescription canadian Patricio http://my.wsbtv.com/_Buy-Valium-Order-Online/blog/712639/6690.html saturday delivery valium overnight no prescription comType http://my.wsbtv.com/_Buy-Viagra-Order-Online/blog/712635/6690.html viagra cheap absurd http://www.geek-pac.org/User:mupased tramadol no rx saturday delivery strip http://community.bonnaroo.com/_Propecia-Buy-Online/blog/699876/12058.html buy propecia where meeting http://www.antlr.org/wiki/display/~nexium77uj U.S. pharmacies for nexium without rx Pixel http://www.geek-pac.org/User:vopamad no prescription acomplia cash on delivery harsh http://www.geek-pac.org/User:weloplas inhailing tramadol Cirlos http://my.wsbtv.com/_Buy-Carisoprodol-Order-Online/blog/712643/6690.html carisoprodol overnight cheap founding http://community.rv.net/_Topamax-Buy-Online/blog/699795/43507.html Topamax next day delivery Average http://community.rv.net/_Accutane-Buy-Online/blog/699797/43507.html cod Accutane for saturday BUDDIES http://www.antlr.org/wiki/display/~fioricet45t fioricet cod saturday asleep