Disable Resizing of a TextArea
When working with text areas, you may encounter the need to restrict the ability of users to resize it. The default behavior allows users to adjust the height and width of the text area by clicking and dragging the bottom right corner.
To disable this resizing ability, implement the following CSS rule:
textarea { resize: none; }
This rule will prevent users from resizing any text area element on the page. However, if you need to disable resizing for only specific text areas, you can use alternative methods:
.textarea1 { resize: none; }
textarea[name=foo] { resize: none; }
#foo { resize: none; }
In addition, you can specify the type of resizing restrictions you want to apply using the following values:
Remember that the resize property only affects the behavior of text areas when the overflow property is not set to visible (which is the default). To use the resize property, you typically need to set the overflow to scroll.
The above is the detailed content of How Can I Disable or Control Resizing of Text Areas in CSS?. For more information, please follow other related articles on the PHP Chinese website!