文本区域文本溢出

发布于 2024-12-22 05:59:03 字数 201 浏览 1 评论 0原文

我写了一个论坛,但我遇到了一个问题...帖子中的文本溢出,它只是传递了 div,即使它有一个设定的宽度。它永远不会创建换行符。我尝试过用
替换 \r\n ,但没有成功。如果它是纯 HTML,它就不会像这样反应。文本当然是从保存在数据库中然后检索的文本区域生成的。

有什么办法可以解决我的这个问题吗?

感谢您抽出时间!

ZyteX

I have written a forum, but I've got one problem... The text from the posts overflows, it just passes the div even though it has a set width. It never creates a linebreak. I've have tried replacing \r\n with
, but with no success. If it would have been pure HTML it wouldn't react like this. The text is of course generated from a textarea which is saved in a database and then retrieved.

Is there any way of solving this issue of mine?

Thanks for your time!

ZyteX

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦过后 2024-12-29 05:59:03

纯粹的猜测,因为没有 jsfiddle 设置:

您的文本显示在具有 white-space: nowrap; 样式的区域中,或者文本中没有空格,因此不能将其拆分为多行。

尝试明确设置 white-space: normal;

Pure guess, since no jsfiddle setup:

Your text is displayed in a zone that has a style white-space: nowrap; OR the text has no space in it, so it cannot be splitted on multiple lines.

Try setting white-space: normal; explicitely.

寄风 2024-12-29 05:59:03

尝试设置 div 的 max-width 。这应该迫使 div 不能溢出其宽度。

Try to set max-width on div. That should force that div cannot overflow its width.

一身仙ぐ女味 2024-12-29 05:59:03

不用再回答这个问题了!我通过创建一个系统来解决这个问题,其中至少需要两个单词,并且单词的长度不能超过 40 个字符。

感谢您的回答!

No need to answer this anymore! I solved it by making a system where you need to have atleast two words and where the length of the words can not be longer than 40 char.

Thanks for answering!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文