CSS/HTML - 将长字符串包裹在文本区域内?

发布于 2024-09-24 12:45:49 字数 103 浏览 1 评论 0原文

我可以在文本区域内创建一个字符串以换行吗? (为了避免水平滚动条)

请注意,我有一个非常长的字符串,没有任何空格(编码文本),并且 css 自动换行属性似乎不起作用......

can I make a string inside a textarea to wrap on multiple lines? (to avoid the horizontal scrollbar)

Note that I have a very long string without any spaces (a encoded text), and css word-wrap properties don't seem to work on it...

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

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

发布评论

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

评论(1

鹿港巷口少年归 2024-10-01 12:45:49

您想要的是默认值,并且应该正常工作,除非您指定了 wrap=onwrap=true (不确定是哪个,但认为是第一个)属性!你需要强制它的是 wrap=hard
但是,您可以使用单词中某处的 ­ 字符指定预定的断点。它不会是可见的,但会在那里中断。
您还可以查看一些函数,例如 http://php.net/manual/ en/function.wordwrap.php
您还可以查看以下 css 设置:

overflow: scroll; 
overflow-y: scroll; 
overflow-x: hidden; 
overflow:-moz-scrollbars-vertical;

What you want is default and should work properly unless you specified the wrap=on or wrap=true (not sure which but think the first) attribute! what you need to force it is wrap=hard
you can however specify predetermined breaking points using the ­ character somewhere in the word. it won't be visible, but break there.
you can also have a look a some function like http://php.net/manual/en/function.wordwrap.php
you can also have a look at the following css settings:

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