This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: HTML and Word Wrapping
Feed Title: Michael Lucas-Smith
Feed URL: http://www.michaellucassmith.com/site.atom
Feed Description: Smalltalk and my misinterpretations of life
James wiggles his accusing finger at HTML and CSS. He's half right. It's the HTML spec that specifies that if a word does not fit on the line, it will not be broken up (like any sane word processor would). This means the box that contains the word must /grow/ to hold the word.
Why in gods name did they decide to do this? - well, because they couldn't identify a nice way to specify where a word should be broken if it does not fit on the line its on.
So what's this got to do with CSS? .. or XML? .. not much actually. But it did highlight to me that CSS can be the answer. One property that can be specified in CSS is white-space. It can be normal, nowrap or pre. 'nowrap' as you can imagine forces things not to wrap even if there is whitespace there to wrap with.
It's not a huge stretch of the imagination to add letterwrap to allow words to be broken up by their letters.
In WithStyle we've followed the XHTML specification for dealing with breaking up words (namely, don't do it) but since we're not only doing XHTML, there's no reason we couldn't have other XML doing letter breaking. If we were to do it, we'd favour it being done by specifying a CSS attribute.
Given the obvious value in doing this, this is one blog entry I'll be flagging for myself so I can go back and actually implement it later. An obvious advantage for having a CSS attribute supply it is that you can use this new CSS setting in a regular web browser and they will happily ignore it (and happily give you long-word-syndrome once more).