I basically want to automatically add line breaks to a VARCHAR variable I acquire from a mysql database trough PHP, so that it shows right. At the moment when I show it trough HTML, all it does is give me a long sentence.
I imagine this can be done with CSS, but overflow: scroll just makes it scroll to the right and left. Use of javascript or JQuery is also accepted.
If it really is a long string with no spaces or line breaks then the
word-wrapCSS property can be set tobreak-word. There are some examples on the MDC page. But, like others have said, if this is a normal sentence with spaces in it then a browser will wrap it automatically providing it’s not in apreblock. If its plain text with line breaks that you want preserved then you can either convert the\nto<br>like elusive suggested, or just place it in apreblock to preserve its text formatting.