Take the 2-minute tour ×

I have the following code

<style type="text/css">
  border:1px solid black;

<div class="text">1234567890123456789</div>

the div contents are displayed outside the div, is there any way such that i can put the text displayed out of the div in the next line, also i don't want to display a scroll bar.

share|improve this question

4 Answers 4

up vote 1 down vote accepted

You'd need to break the text up character-wise, not by word. It's being rendered as a really long word (the same way it's done in books), so force the browser to break it even if there are no spaces:

word-wrap: break-word;
share|improve this answer
thank you, it worked. –  user475685 Mar 14 '11 at 5:26

Line wrapping is possible, just have to set the 'white-space' condition to normal.

See: http://www.1keydata.com/css-tutorial/wrap.php

share|improve this answer

You may find that the reason the text is not wrapping is that you have no spaces in your div contents: try something like 1234 6789 1234 6789 and see if it wraps.

share|improve this answer

Yes, it is possible to break the continuous text using following code after every character.

<WBR>   --This works for Mozilla and other browsers
&Shy;   --For IE you need to add

In your example: 1234567890123456789

The text should be like this in code behind: 1234567890123456789

While rendering the text, the browser will hide this / ­ tag.

the problem with using these tag is: When you select the text on browser and copy it to notepad, you will find a '-' character is added in between every character.

Please check whether it works for you.

share|improve this answer

Your Answer


