How to disable in one or both directions the resizable property of a textarea
As web developers, we often want to give users a seamless and consistent experience. While the default behavior of a <textarea>
element allows users to resize it by dragging the bottom-right corner, there are times when you may want to restrict this functionality. For instance, you might want to maintain a specific layout or prevent a user from accidentally making a textarea too wide, which can disrupt the design of your page.

resize: vertical;
This is where the power of CSS comes in. While you might expect there to be a direct HTML attribute for this, like resizable="false"
, there isn't one. The CSS resize
property is the standard and most flexible way to control a textarea's resizing behavior.
The Versatile CSS resize Property
The resize
CSS property specifies whether an element is resizable by the user. It can take on a few different values, giving you precise control over how your text areas behave.
resize: none;
: This is the most direct way to disable resizing. It removes the resizing handle entirely, ensuring the user cannot change the dimensions of the textarea.resize: vertical;
: This value restricts the resizing to the vertical direction only. The user can make the textarea taller or shorter, but not wider or narrower. This is a great option for forms where a fixed width is crucial but you still want to allow users to add more text without scrolling.resize: horizontal;
: The opposite ofvertical
, this option allows the user to resize the textarea only in the horizontal direction. This is less common but can be useful in specific layouts.resize: both;
: This is the default value for many browsers, allowing the user to resize the textarea both horizontally and vertically. You'll typically only use this if you want to explicitly enable the default behavior on a page where a global stylesheet has disabled it.
Real-World Examples.
To see these properties in action, let's look at two prominent websites.

Example 1: UpWork Proposal Textarea
The user-friendly interface of UpWork, a popular freelancing platform, provides a great example of restricted resizing. The textarea where freelancers describe their proposals is a fantastic user experience. By default, the width is fixed to fit the layout, but you can see that the bottom-right corner has a handle that allows you to drag it vertically. This means you can add as much detail as you need without breaking the page's design. This is achieved with resize: vertical;
.

Example 2: New York Times "Tips" Page
On the other end of the spectrum is the New York Times "Tips" page, where you can submit a tip to the newsroom. Here, the textarea uses the default browser behavior, allowing users to resize it in both horizontal and vertical directions. While this might seem to give the user maximum freedom, it can come with a significant risk.
Allowing unrestricted horizontal resizing can break the form's layout. For instance, if a user makes the textarea very narrow, the form's labels and other elements may no longer align correctly, or the text inside the textarea could become unreadable. This shows the potential downside of giving users too much control, as it can lead to unintended layout issues that disrupt the design and provide a poor user experience.
Why an HTML Attribute For Textarea Was Never Developed
You might wonder why a simple HTML attribute like resizable="false"
was never created for the <textarea>
tag. The reason lies in the separation of concerns. HTML's primary purpose is to define the structure and content of a web page. CSS, on the other hand, is designed to control the presentation and styling of that content.
The flexibility of the resize
property is a testament to this design philosophy. Instead of a simple true
/false
switch that an HTML attribute would likely provide, the CSS property offers nuanced control, allowing you to choose between disabling resizing entirely or restricting it to a specific direction. This level of granular control is a core strength of CSS and is why it remains the ideal tool for managing the visual properties of your web elements.