I have a textarea that contains code. The problem is, that in order for it to look good, the Textarea has to stop wrapping the text, and use a Horizontal Scrollbar instead.
I tried this:
textarea
{
overflow: scroll;
overflow-y: scroll;
overflow-x: scroll;
overflow:-moz-scrollbars-horizontal;
}
and this:
textarea
{
overflow: auto;
overflow-y: scroll;
overflow-x: scroll;
overflow:-moz-scrollbars-horizontal;
}
However the Horizontal Scrollbar is not applying.
What is the correct way of doing this?
Set the
wrapattribute tooffDemo: http://jsfiddle.net/wesley_murch/HZkLK/
There is also a
softandhardvalue forwrap. The only decent reference on this I found on tizag.com, although there must be better ones out there. From the linked page:I’m not sure about HTML5, but this won’t validate in XHTML or HTML4 (the validator tells me: there is no attribute “WRAP”), but it does certainly seem to work in the following browsers I checked:
I don’t think this can be done cross-browser with CSS. I was coming up short trying to find official docs/support for this, and when I did find something useful, it was here on Stack Overflow!
See this answer for more details:
How remove word wrap from textarea?
However, the CSS solution provided there is not working for me on Firefox 4…