How to disable textarea resizing?

后端 未结 6 1146
悲&欢浪女
悲&欢浪女 2021-01-30 03:00

I need to disable textarea horizontal resize. Sometimes I want to allow vertical resize on the textarea.

Whenever I create a contact us page the textarea is making my

相关标签:
6条回答
  • 2021-01-30 03:12

    disable horizontal and vertical with limit

    textarea { 
        width:100%;
        resize:vertical; 
        max-height:250px; 
        min-height:100px; 
    }
    
    0 讨论(0)
  • 2021-01-30 03:13

    For textarea I used width: 500px !important and height: 350px !important, so this CSS codes prevent user resize, but if you have other tags you must use resize: none, for complete explanations read This Link.

    For example, for a p tag you must set overflow property with a value that is not visible and then set resize, none, both, vertical, horizontal.

    0 讨论(0)
  • 2021-01-30 03:18

    You can use css

    disable all

    textarea { resize: none; }
    

    only vertical resize

    textarea { resize: vertical; }
    

    only horizontal resize

    textarea { resize: horizontal; } 
    

    disable vertical and horizontal with limit

    textarea { resize: horizontal; max-width: 400px; min-width: 200px; }
    

    disable horizontal and vertical with limit

    textarea { resize: vertical; max-height: 300px; min-height: 200px; }
    

    I think min-height should be useful for you

    0 讨论(0)
  • 2021-01-30 03:19

    disable all

    textarea { resize: none; }
    
    0 讨论(0)
  • 2021-01-30 03:36

    With some css like this

    textarea
    {
       resize: none;
    }
    

    Or if you want only vertical

    textarea { resize:vertical; }
    

    Or horizontal

    textarea { resize:horizontal; } 
    

    or both ( not your case)

    textarea { resize:both; } 
    
    0 讨论(0)
  • 2021-01-30 03:36

    You can put this in the CSS file:

    textarea {
      resize: none;
    } 
    
    0 讨论(0)
提交回复
热议问题