This is a very simple question, bu开发者_Go百科t embarrassingly enough I am not sure how to implement this :\
I have div elements with text boxes inside them for users to write comments,replies etc... Very standard concept. The div that contains the text is a certain width. If someone where to write something with out using any spaces, instead of breaking down a line when it hits the right edge of the div, it just keeps going and breaks the element.
I am just wanting to know how to make it line break when it hits the edge spaces provided by user or not.
thanks in advance
There is a word-wrap
CSS property that will force long words to wrap:
word-wrap: break-word;
You might also want to look into overflow
.
Hmmmm...This is an interesting problem. I'm thinking what I would do would be to implement a JavaScript function that would "read" the length of lines and if a single block of writing is longer than the max length, I would grab a substring of (max length - 1), append a dash (-) to the end of it, add in a line break, and proceed from there.
精彩评论