Hit enter after type your search item

HTML textarea resize: How to disable with 3 demos

How to disable textarea resizing

You may use the resize: none property to disable resizing of a textarea in a web browser.

Generally, the textarea can be stretched to expand that may affect different sections of a webpage.

By using the CSS, you may disable this overall or by specifying a particular direction as shown in the examples below.

A fixed size textarea example

By simply using resize: none property, you may disable resizing of a textarea. See this demo where this is assigned to the textarea in <style> section:

textarea resize

See online demo and code

You can see, textarea size cannot be increased or decreased horizontally or vertically. The size is specified by height and width properties by using CSS and it is fixed.


 

Allowing resizing of textarea vertically only

By using resize: vertical; property, you may restrict resizing of the textarea vertically. Click on the link or image below to open the demo page and try resizing the textarea vertically and horizontally:

textarea resize vertical

See online demo and code

The code:


 

A demo of horizontal resizing

In this demo, only horizontal resizing is enabled.

textarea resize horizontal

See online demo and code

The code:


 

In above two examples, you can see the CSS classes are used rather generally specifying the textarea in style section.

This is because the specific properties will apply to only particular textarea where you assign this class. If textarea was used like in the first example, the restriction would have applied to all textarea in the web page.

This div height required for enabling the sticky sidebar