0

Possible Duplicate:
how remove wordwrap from textarea

I have a textarea which I fill in PHP (I'm reading the text from a text file).

Now, if the text is longer than the text-area, it wraps it instead of showing a horizontal scroll bar. And I want to change this.

I've tried those possibilities in CSS, and none of them worked:

overflow: auto
overflow: scroll
overflow-x: scroll

Can somebody help please?

Thanks!

Community
  • 1
  • 1
Florian Müller
  • 7,448
  • 25
  • 78
  • 120

2 Answers2

1

Use wrap="off" attribute:

<textarea wrap="off"></textarea>
Sarfraz
  • 377,238
  • 77
  • 533
  • 578
1

Use textarea@wrap:

<textarea wrap="hard" cols="2"></textarea>

wrap="soft" is the default.

The wrap attribute is an enumerated attribute with two keywords and states: the soft keyword which maps to the Soft state, and the hard keyword which maps to the Hard state. The missing value default is the Soft state.

The Soft state indicates that the text in the textarea is not to be wrapped when it is submitted (though it can still be wrapped in the rendering).

The Hard state indicates that the text in the textarea is to have newlines added by the user agent so that the text is wrapped when it is submitted.

If the element's wrap attribute is in the Hard state, the cols attribute must be specified.

Mathias Bynens
  • 144,855
  • 52
  • 216
  • 248