Possible Duplicate:
wordwrap a very long string
My code
<div style="width:40px;">adfdddddddddddddddddddd</div>
This code should make 4 lines but it is displaying the output in one line.
Possible Duplicate:
wordwrap a very long string
My code
<div style="width:40px;">adfdddddddddddddddddddd</div>
This code should make 4 lines but it is displaying the output in one line.
Try
<div style="width:40px;word-wrap:break-word;">adfdddddddddddddddddddd</div>;
For word wrap consider adding this class.
.wordwrap {
white-space: pre-wrap; /* CSS3 */
white-space: -moz-pre-wrap; /* Firefox */
white-space: -pre-wrap; /* Opera <7 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* IE */
}
See the reference here Is there a way to word-wrap long words in a div?
Your code is showing the output in one line because it's taking the content as a single word. A single word will be shown in a single line. Try this code using some sentence then you will get the desired output. You can try something like the following
<div style="width:40px;">This is a sentence.</div>