How Facebook deals with text overflow?
I'm doing a comments system, but there's something that keeps bugging me. For an example when I post a comment that contains 300 symbols without spaces between them it will overflow the commentbox. Then I use
overflow:hidden
but that isn't exactly what I want. Wh开发者_StackOverflowen I try the same experiment in Facebook comment, instead of overflowing and hiding, the whole string would be shown and will be somehow separated on new lines. How can I do this?
They are probably using word-wrap: break-word;
.
As you can see from the link, it is supported in all major browsers.
Try this in your textarea tag
<textarea wrap="soft">
or this..
<textarea wrap="hard">
or you can use css to do it
textarea {
word-wrap: break-word;
}
精彩评论