How do I disable the resizable property of a textarea?

 

To disable the resizable property of a textarea element in HTML, you can use CSS to set the resize property to none. Here's how you can do it:

html
<!DOCTYPE html> <html> <head> <style> /* Apply the CSS rule to disable textarea resizing */ textarea { resize: none; } </style> </head> <body> <textarea rows="4" cols="50">This is a non-resizable textarea.</textarea> </body> </html>

In this example, the resize: none; CSS rule is applied to the textarea element, which prevents users from resizing the textarea. The rows and cols attributes control the initial number of rows and columns of the textarea.

By using this approach, you can make a textarea non-resizable and restrict its size to the dimensions you've set initially.

Comments