Disable textarea resizing for Safari and Chrome
Posted July 4th, 2009 in HTML and CSS
The webkit based browsers Safari and Google Chrome allow the HTML textarea to be resized by default with a grab handle in the bottom right corner. There may be times when you want to disable this function so a textarea cannot be resized.
Screenshot example of resize grip
The following screenshot shows the resize grip; I've highlighted it with a red circle.

The user can make the textarea larger but cannot size it back down below the original size.
CSS to disable resizing
The CSS to disable resizing for all textareas looks like this:
textarea {
resize: none;
}
You could instead just assign it to a single textarea by name (where the textarea HTML is <textarea name="foo">):
textarea[name=foo] {
resize: none;
}
Or by id (where the textarea HTML is <textarea id="foo">):
#foo {
resize: none;
}
Validation errors
The above is only supported by the webkit browsers. If you run it through a CSS validator (such as the W3C CSS validator) you'll get a warning like this:
Property resize doesn't exist in CSS level 2.1 but exists in [css3] : none
Related posts:
- Always show a vertical scrollbar in Firefox, Chrome, Safari and Opera (Saturday, June 20th 2009)
- Fieldset and legend tags in HTML forms (Saturday, May 2nd 2009)
- Using the <label> tag for HTML forms (Saturday, April 25th 2009)
- Switch off autocomplete for an HTML form field (Saturday, December 6th 2008)
- Style an HTML form input with CSS and jQuery (Saturday, July 26th 2008)
Share or Bookmark
Share or Bookmark this page using the following services. You will need to have an account with the selected service in order to post links or bookmark this page.
Subscribe or Follow
Subscribe via RSS or email, or follow me on Facebook or Twitter below. The RSS icon takes you through to Feedburner where you can select the service or application to use.

