gpt4 book ai didi

html - 文本区域中的换行符被忽略

转载 作者:太空宇宙 更新时间:2023-11-04 12:11:06 25 4
gpt4 key购买 nike

好吧,这是一个很常见的奇怪问题,但我似乎无法在任何地方找到解决方法。

我正在从数据库文本字段中提取数据以显示在文本区域中以供编辑。但是textarea不会显示空行。

例子:

数据库数据

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com