Reputation: 21
I'd like to set my text area to wrap in the middle of a word when the text hits the edge of the area. For example:
Normal text area behavior:
word word word
longword
Behavior I want:
word word word lo
ngword
It seems so simple but I've searched around and I can't find any solutions, surely there's an attribute, or CSS property, for this, right?
Upvotes: 2
Views: 1524
Reputation: 21
A quick google, and found this: How to word wrap text in HTML?.
Had a go at it myself here: JSFiddle
I used this code.
<div style="width:50px; word-wrap:break-word">
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
Upvotes: 0
Reputation: 10070
You may try the word-wrap
(overflow-wrap
) and/or word-break
CSS property:
textarea
{
word-wrap:break-word;
word-break:break-all;
}
Upvotes: 3