Best practices: displaying text that was input via multi-line text box
Posted
by chris
on Stack Overflow
See other posts from Stack Overflow
or by chris
Published on 2010-06-09T14:59:22Z
Indexed on
2010/06/09
15:02 UTC
Read the original article
Hit count: 182
I have a multi-line text box. When users simply type away, the text box wraps the text, and it's saved as a single line. It's also possible that users may enter line breaks, for example when entering a "bulleted" lists like:
Here are some suggestions:
- fix this
- remove that
- and another thing
Now, the problem occurs when I try to display the value of this field. In order to preserve the formatting, I currently wrap the presentation in <pre>
- this works to preserve user-supplied breaks, but when there's a lot of text saved as a single line, it displays the whole text block as single line, resulting in horizontal scrolling being needed to see everything.
Is there a graceful way to handle both of these cases?
© Stack Overflow or respective owner