如何在HTML中包装没有空格的长行? [英] How to wrap long lines without spaces in HTML?

查看:142
本文介绍了如何在HTML中包装没有空格的长行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户输入长行,没有任何空格或空格,它将通过比当前元素更宽的宽度来破坏形成。例如:


HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA ........................ ................................................. ................................................. .................


我试过只使用 wordwrap()在PHP中,但问题是如果有一个链接或其他有效的HTML,它打破了。



CSS似乎有几个选项,但没有一个在所有浏览器中工作。请参阅IE中的换行。



如何解决这个问题?

解决方案

我没有亲自使用它,但连字符看起来很有前途。 p>

另请参阅相关(可能重复的)问题:




If a user types in a long line without any spaces or white space, it will break formating by going wider than the current element. Something like:

HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA.............................................................................................................................................

I've tried just using wordwrap() in PHP, but the problem with that is if there is a link or some other valid HTML, it breaks.

There seems to be a few options in CSS, but none of them work in all browsers. See word-wrap in IE.

How do you solve this problem?

解决方案

I haven't personally used it, but Hyphenator looks promising.

Also see related (possibly duplicate) questions:

这篇关于如何在HTML中包装没有空格的长行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆