Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable multiline input being dynamically resized by user?

I have a multiline input on my html form and some browsers (firefox 4 and chrome) allow users to resize it dynamically. It is nice, but it breaks my layout. Is it possible to disable this feature?

Thanks

like image 532
Burjua Avatar asked Mar 24 '11 18:03

Burjua


People also ask

Is the MultiLine text input control?

The <textarea> tag defines a multi-line text input control. The <textarea> element is often used in a form, to collect user inputs like comments or reviews. A text area can hold an unlimited number of characters, and the text renders in a fixed-width font (usually Courier).

Which element can you use to allow MultiLine input?

To create a multi-line text input, use the HTML <textarea> tag. You can set the size of a text area using the cols and rows attributes. It is used within a form, to allow users to input text over multiple rows.


2 Answers

If users resize the field, it's probably because they want (or need) it to be bigger 1.

In such a case, you should consider your users know what they are doing, are doing it because they want / need to, and that they will accept the layout to be a little broken, provided it allows them to use that textarea.


Still, if you want to do that (you shouldn't), quoting How do I disable textarea resizing? :

textarea {
    resize: none;
} 


1. I don't see very well, and when I zoom, or make something bigger, it's because I need too -- and, in such a case, I prefer a layout a bit broken to a website I cannot use !

like image 74
Pascal MARTIN Avatar answered Sep 20 '22 18:09

Pascal MARTIN


Use CSS:

textarea {
   resize: none;
}

See resize property @ MDC.

A better solution, however, is to fix your layout so that resizing the textarea doesn't break the layout (at least for reasonable amounts of resizing). Depending on just how, and how badly, it breaks the layout, users might not event mind it. The typical web user will probably never even notice the little resize handle anyway.

like image 32
Matt Ball Avatar answered Sep 19 '22 18:09

Matt Ball