Forum Moderators: not2easy

Message Too Old, No Replies

breaking long words

         

dmd_anfini

3:07 am on Feb 23, 2010 (gmt 0)

10+ Year Member



hi, I want to know if there is a way to break long words (or continuous text without spaces) into css. For example, a word with 200 characters overflows the width of a box, so I need to break it. The way I solve this is to define a max number of characters for any word, so that this max don't overflow the box width. If a word is longer than the max I divide into two words and put a <br/> tag in between. Maybe there is a more elegant way to do this..maybe in css

is there a better way to solve this, in css perhaps?

alt131

5:04 am on Feb 23, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi dmd_anfini,

Deepending on your target market, have you tried word-wrap:break-word ? It is css3 [w3.org], but has been recognised since ie5, ff3.5, winsafari3, and I think .. OP10.

dmd_anfini

10:37 pm on Feb 24, 2010 (gmt 0)

10+ Year Member



thanks for the reply, I will use that when css3 is more widely adopted...I guess for the time the solution is to word wrap in server side scripting