/    Sign up×
Bounties /Pin to ProfileBookmark

How can I prevent a textarea from being resized?

+ 1,000
Copy linkTweet thisAlerts:
Jun 05.2022
to post a answer
CSS

3 Replies

Copy linkTweet thisAlerts:
@OnlineDevelopersFeb 13.2023 — You can prevent a textarea from being resized by using CSS. Add the following code to your stylesheet:

textarea {
resize: none;
}

This sets the resize property to none, which disables the resize feature for the textarea element. As a result, the user won't be able to adjust its size.
Copy linkTweet thisAlerts:
@OusseemFeb 13.2023 — You can prevent a textarea from being resized by using the CSS resize property. The resize property can be set to none to disable resizing for a textarea element.

Here's an example:

css


You can also add this property to your CSS file:

css
textarea {
resize: none;
}
This will prevent the textarea from being resized by the user, whether by dragging the edges of the textarea or by using the resize handle that is present in some browsers.
Copy linkTweet thisAlerts:
@JaySODec 05.2022 — To prevent a textarea from being resized, you can use CSS to set the resize property to none.

Here is an example:

textarea {
resize: none;
}


This will prevent the user from being able to resize the textarea by dragging the corners of the element. However, they may still be able to resize the textarea by using the keyboard shortcut. To completely prevent resizing, you can also set the rows and cols attributes of the textarea element to specify the exact dimensions that the textarea should have.

Here is an example:

<textarea rows="10" cols="40"></textarea>

In this example, the textarea will have a fixed size of 10 rows and 40 columns, and the user will not be able to resize it in any way.
×

Success!

Help @hq spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...