我一直在做评论框,看到我的评论后我遇到了问题.我想要的是当它超过容器时让我的评论自动断行,但我现在得到的是一条直线.
例如:
tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
我希望我的文字可以是这样的:
ttttttttttttt ttttttttttttt ttttttttttttt ttttttttttttt
我应该使用什么来使我的文本自动断行?
thi*_*dot 24
这听起来像你正在追求word-wrap: break-word,它的跨浏览器变种.
请参阅:https://developer.mozilla.org/en/CSS/white-space
selector {
word-wrap: break-word; /* IE 5.5-7 */
white-space: -moz-pre-wrap; /* Firefox 1.0-2.0 */
white-space: pre-wrap; /* current browsers */
}
Run Code Online (Sandbox Code Playgroud)
尝试使用字符串替换:
$line_broken = str_replace("\n", "<br />", $comment);
Run Code Online (Sandbox Code Playgroud)
但如果不看你的代码就很难判断。
| 归档时间: |
|
| 查看次数: |
36010 次 |
| 最近记录: |