tags:

views:

36

answers:

2

I have a small space in which I would like to put writing. Problem is, if a long word is inputted, it flows off the side because there is no space.

I could do overflow:hidden, but this isn't what I am looking for. Ideally I would like the word to drop to a new line with a '-' before it.

The word is on a line of its own to begin with so a
will not fix the problem.

+3  A: 

word-wrap:break-word in CSS does this (ok, without the - in the newline), but it had some browser issues back when I tried it, so be careful ;).

Second solution is wrapping letters in text (or packets of 3 or 5 letters etc.)in <span></span> so that they'll wrap but have no spaces when fitting the line.

to add the hyphen You could then use jquery and search for elements having certain left offset to prepend hyphens.

naugtur
word-wrap I tested on FF, Opera and Webkit, works AWESOME.As for the spans, they wouldn't work as the actual string is being imported from Twitter.
Henryz
Doesn't matter. This can be done on the fly, even with some javascript. But I'm happy CSS was enough. But see the IE. As far as I remember it didn'twork in older FF and in some or all IEs
naugtur
A: 

For CSS, Here is webmaster example in comments last

http://fun2mobo.awardspace.biz

Works I.e. n Opera and others too check pls

Sunny