[thelist] Tip of the Moment: wrapping long words in short divs

Jacques Capesius jacques_capesius at cnt.com
Tue Feb 10 13:53:17 CST 2004


Hi folks, I'm trying to house German content in divs whose width are only 25
ems long or so. As German words can get pretty long (eg.
"Rechenzentrumskonsolidierung"), often times, words would stretch the
boundaries of their containers and knock any following divs out of place. 

This might be old news to some of you, but I found a neat trick to break up
words that get too long, and I thought I'd share it. God knows I owe a tip
or two (or ten).

<tip type="Wrapping Long Words" author="Jacques Capesius">

Use an HTML 4.0 "Small Hyphen" (&#173;) to force a line break when the word
is
too long to fit within the horizontal confines of its containing <div> or
<td>, etc.

Place the Small Hyphen within the word you wish to break, at the point you
wish to break it should the need arise. If the word is too long to fit
within its container, the word will be stopped at the hyphen point, a hyphen
will be displayed and the word will be continued on the next line. If the
container is wide enough to display the word, the hyphen will not be shown
and the word will remain unbroken.

eg. thiswordis&#173;waytoobig would be broken into:
thiswordis-
waytoobig 

</tip>


More information about the thelist mailing list