How to wrap long lines without spaces in HTML?

2019-01-08 11:58发布

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?

14条回答
Anthone
2楼-- · 2019-01-08 12:45

I dodge the problem by not having my right sidebar fixed like that :P

查看更多
可以哭但决不认输i
3楼-- · 2019-01-08 12:49

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

Also see related (possibly duplicate) questions:

查看更多
登录 后发表回答