This is a problem, that has annoyed me for a long time. If I have a开发者_JAVA百科 textarea with long text in it, overflow doesn't work, even if content goes over the visible area. How to fix this?
Martti Laine
From the comments:
Horizontal is the goal. It is set at scroll/auto, but contents of the textarea are still wrapped. If I write manually something to textarea, it doesn't wrap.
So you basically want to disable the wrapping of lines? Add white-space: nowrap;
to the style. This has another impact however: you cannot display nor insert newlines in the textarea anymore.
Do you have a height set on your area? (Also, I am assuming this not a <textarea>
but a <div>
or something like that).
So, you want the text to wrap when you manually enter text? If you are using a <textarea>
control, you might try setting the height and width:
<textarea id="test" style="width:300px; height:50px">
The quick brown fox jumps over the lazy dog.
</textarea>
精彩评论