好吧,这是一个很常见的奇怪问题,但我似乎无法在任何地方找到解决方案。
我正在从数据库文本字段中提取数据以显示在文本区域中以进行编辑。但文本区域不会显示空行。
示例:
数据库数据
This is a line of text
this is another line of text with a line break above.
这就是 TEXTAREA 中显示的内容
This is a line of text
this is another line of text with a line break above.
有谁知道如何让空行真正在实际的 HTML 文本区域中表示。
最佳答案
对于输出,添加以下内容:
<style type="text/css">
.textareaOutput {
white-space: pre-wrap;
}
</style>
关于html - 文本区域中的换行符被忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29041044/