views:

101

answers:

1

Hi

can I make a string inside a textarea to wrap on multiple lines? (to avoid the horizontal scrollbar)

Note that I have a very long string without any spaces (a encoded text), and css word-wrap properties don't seem to work on it...

+2  A: 

What you want is default and should work properly unless you specified the wrap=on or wrap=true (not sure which but think the first) attribute! what you need to force it is wrap=hard you can however specify predetermined breaking points using the ­ character somewhere in the word. it won't be visible, but break there. you can also have a look a some function like http://php.net/manual/en/function.wordwrap.php you can also have a look at the following css settings:

overflow: scroll; 
overflow-y: scroll; 
overflow-x: hidden; 
overflow:-moz-scrollbars-vertical;
Joe Hopfgartner
It's `wrap="off"` that provokes the scrollbar in Firefox, IE and WebKit. This is documented at MSDN but is not a standard value for `wrap` in HTML5.
bobince
is `wrap` even a valid attribute any more? The W3 don't seem to think it exists, and even the non-affiliated, pause for shudder, W3schools don't mention it any more. Ah, oops. Html 5...sorry. I'll just get my coat... =/
David Thomas
its not :) his problem was opera (see above)
Joe Hopfgartner