Reputation: 1486
Is there any other way to word-wrap a text inside a div? I can't use word-wrap in CSS since I can only use CSS1 and some CSS2.
*Use javascript or CSS
Thank you!
.test_wordWrap {
position: absolute;
top: 45px;
left: 20px;
width: 250px;
white-space: pre-wrap;
}
Upvotes: 0
Views: 119
Reputation: 8488
Can you try this:
<div class="wordwrap">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div>
.wordwrap
{
width : 50px;
/* wrap long text and urls */
white-space: pre; /* CSS 2.0 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -moz-pre-wrap; /* Mozilla */
word-wrap: break-word; /* IE 5+ */
}
Upvotes: 0
Reputation: 687
You can try this one baby :)
p.wrap {
width: 11em;
border: 1px solid #000000;
word-wrap: break-word;
}
<p class="wrap"> This paragraph is very long long long long but not long enough to say how much you love a person lol</p>
Upvotes: 0
Reputation: 584
Try it is...
html
<div class="wraptext">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
css
.wraptext{
white-space:nowrap;
overflow:hidden;
width:50px;
}
Upvotes: 0
Reputation: 3880
Maybe this will help:
.myClass {
white-space: normal;
overflow: hidden;
}
Upvotes: 1