views:

125

answers:

3

How to control a running text? This is a user generated content, where user used to give with out giving space to the text. for example:

abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh

This goes beyond the specific block. Is there is a way to wrap the text? how can i control it and i also want that to be worked in ie6 also...

+6  A: 

By default, strings don't wrap without a space.

I wonder how SO handles it.

WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

hyperslug
lol. In Firefox it goes all the way.
Anzurio
lol. +1 for curiosity
Umair Ahmed
This is genius :)
MJ
+1  A: 

You could use overflow:scroll; in your CSS, this would put a horizontal scroll bar. Should work in IE.

beggs
+2  A: 

You can make strings with no spaces wrap by using the following CSS property:

word-wrap: break-word;

According to the MDC page on the word-wrap property, it is supported in IE 5.5+, Firefox 3.5+, and Safari 1.0+ (but not Opera).

Steve Harrison
I tried this, but it is not working in firefox2
Webdevelopertut
That's because Mozilla adopted it late—you need Firefox 3.5+ in order for it to work. IE and Safari, however, seem to have had it for a while.
Steve Harrison
I've updated my answer to include version numbers.
Steve Harrison