Take the 2-minute tour ×

I found out that the following css property disables line wrapping in a html textarea.

textarea {
    white-space: nowrap;

This is however causing a strange behaviour. Every few refreshes, all newlines in the textarea seem to disappear, putting all text on one line.

I'm using google chrome 12.0.x

Is this a known bug or is it more likely to be an error on my part somewhere else?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Browser support for white-space on <textarea> is patchy at best. This is not a CSS solution, but it should do the trick:

<textarea name="message" wrap="off"></textarea>

I have added the wrap="off" attribute. Which doesn't seem to be officially supported, but has been used happily for a number of years.

share|improve this answer
Thanks! This works great. It's not as easy to implement as a css-based solution but at least this attribute does the trick. –  geoffreydv Jul 13 '11 at 11:53

Your Answer


