A Quick Piece of Awesome

So you've got a slim area of space and are planning to put some text in there; that's cool, you've got all the vertical space you need. The only problem is, if your space is slim enough, long strings of gapless text just won't fit. That includes long words, URLs and email addresses.

Normally, this would make your page look messy, with the word continuing over the side of the box and continuing to hither and yon. Most people assume that the only thing to do is to hide the overflow and hope that your viewers won't need to view that text.

Luckily, there's a solution. CSS has introduced word-wrap, which will break up a word that is just too long to fit in its box. This won't work in older browsers, so you'll still have to employ the hidden overflow for them, but most people will be able to read the entire text without muss or fuss. Simply put this into your stylesheet and you're away laughing:

word-wrap: break-word;

And there you have it. One inedible text string broken up into bite size morsels. Bon appétit.

 
06/03/2011