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 <br/> will not fix the problem.
word-wrap:break-wordin 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.