How to disable multiline input being dynamically resized by user?

拟墨画扇 提交于 2019-12-22 04:01:35

问题


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


回答1:


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 !




回答2:


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.




回答3:


Use CSS:

textarea {
    resize: none;
}



回答4:


In your CSS, add this: textarea { resize: none; }




回答5:


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.



来源:https://stackoverflow.com/questions/5424001/how-to-disable-multiline-input-being-dynamically-resized-by-user

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!