I have a multiline input on my html form and some browsers (firefox 4 a开发者_如何学JAVAnd chrome) allow users to resize it dynamically. It is nice, but it breaks my layout. Is it possible to disable this feature?
Thanks
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 !
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.
Use CSS:
textarea {
resize: none;
}
In your CSS, add this:
textarea {
resize: none;
}
AFAIK you can't disable that. But it can't possibly break your layout until the user takes action, and you can't prevent that anyway.
精彩评论