CSS code to break long words when wrapping?

Status
Not open for further replies.

HairyHun

Masturbating Bandit
Oct 11, 2007
576
2
0
Hi,

I believe I have seen this somewhere on facebook. There was a very long word and it was actually broken in 2. I cannot seem to find where it was as I wanted to check the source

I need something like that. basically i don't want very long words to break the layouts of my website.

Any solutions for this?

HH
 


I am not aware of any CSS 2.1 standard abilities to auto-hyphenate long words, it could quite possibly be javascript based, or was done serverside if we're talking bout facebook here. I basically know you can easily wordwrap with PHP if you tell it a character limit.
 
Code:
<span>TESTINGTOSEEIFFACEBOOKHASSOMEINTELLIGENT</span><wbr><span class="word_break"></span><span>WAYOFHANDLINGREALLYLONGSTRINGSTHATIHAVEN</span><wbr><span class="word_break"></span>'TTHOUGHTOFYETLOLIHOPEITDOES</h3></div>
That's from Facebook, appears to be server side.
 
css 3 has word wrap word-wrap: break-word; but that doesn't work in a whole lot of browsers.
wbr
also not full cross browser compat. javascript is probably your best bet but I try not to use it.
 
Status
Not open for further replies.