Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Textarea word wrap only on line breaks

So, I have a textarea that is filled with text from the DB for the user to edit. The text from the DB contains line breaks in it (\r\n). I would the textarea to only line wrap on line breaks. I've messed around with different white-space attributes, but none seem to work. Right now, I have:

textarea
{
    width: 60em;
    height: 40em;
    white-space: pre-line;
    overflow: auto;
}

It does break on the line breaks, BUT ALSO breaks when the text on a line goes longer than 60em. How do I get it to only break on line breaks?

like image 458
ScubaSteve Avatar asked Mar 22 '23 18:03

ScubaSteve


1 Answers

As andi pointed out, the answer is here: HTML Textarea horizontal scroll

<textarea wrap="off"></textarea>
like image 55
ScubaSteve Avatar answered Apr 08 '23 09:04

ScubaSteve