resize

Lets the user resize an element by dragging its corner.

Initial value
none
Inherited
No
Animatable
no
Applies to
elements with overflow other than visible, textarea fields
JavaScript
element.style.resize = "vertical"
On this page

Example

#
CSS
textarea {
  resize: vertical;
  min-height: 80px;
  max-height: 240px;
}
Preview

Definition and usage

#

The resize property adds a handle in the bottom right corner of an element that the user can drag to change its size. <textarea> fields have it by default, because browsers set resize: both on them.

You can allow resizing in both directions (both), only horizontally (horizontal), only vertically (vertical), or turn it off entirely (none).

It only works on elements with an overflow other than visible. Size constraints such as max-width or min-height are still respected.

Syntax

#
Syntax
resize: none | both | horizontal | vertical;

Values

#

Values in practice

#

none

No handle, fixed size.
.demo { resize: none; }

both

Width and height can change.
.demo { resize: both; }

vertical

Height only, the width stays fixed.
.demo { resize: vertical; }

horizontal

Width only.
.demo { resize: horizontal; }

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • In forms, set text fields to resize: vertical. Stretching horizontally usually breaks the layout.
  • Don’t disable resizing of fields for no reason. Users writing longer texts are happy to use it.

Related entries

#

Spotted a mistake or missing an example? Write to us.