Thanks to visit codestin.com
Credit goes to www.cssportal.com

CSS Portal

CSS resize Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The resize property controls whether and how the user can interactively change the size of an element’s box using the browser’s native resizing UI. When enabled, the element typically presents a draggable handle that lets users expand or shrink the box along one or both axes; when disabled, the box remains fixed regardless of pointer interaction. This property is most obvious on controls such as multi-line text inputs and dialog-like panels, but it can be applied to any element that establishes a box, and its practical effect depends on the element’s ability to overflow and accept a change in its used width/height.

Because resizing changes an element’s used dimensions, it interacts closely with layout and constraint properties: a user-initiated size change will be subject to any minimum or maximum constraints placed on the box, and will cause normal reflow of surrounding content as the box grows or shrinks. For example, authors commonly combine it with min-width and max-width constraints to limit how small or large the user can make an element, and with overflow settings to control whether the element shows scrollbars or clips its content when its size is reduced. The visual affordance and resizing behavior are implemented by the user agent, so the exact handle appearance and the way the box interacts with margins, padding, and borders can vary.

Enabling user resizing has usability and accessibility implications: it can help users tailor input areas to their needs, but it can also break carefully designed responsive layouts or obscure adjacent content if unconstrained. To provide a good experience, authors should consider how resized elements affect surrounding flow and whether to constrain them with appropriate layout rules. If you need to respond programmatically to size changes, use DOM measurement tools (for example, a ResizeObserver) rather than relying on style-change events; and consider the element’s box model behavior by coordinating with box-sizing so your paddings and borders behave as expected when the user resizes the element. Finally, note that the presence and exact behavior of the resize affordance are determined by the browser and platform, so testing across target environments is recommended.

Definition

Initial value
none
Applies to
elements with 'overflow' other than visible
Inherited
No
Computed value
Specified value
Animatable
No
JavaScript syntax
object.style.resize

Interactive Demo

Resize Property Demo, try resizing this element.

Syntax

resize: none | both | horizontal | vertical | inherit

Values

  • noneThe element offers no user-controllable method for resizing the element.
  • bothThe element displays a mechanism for allowing the user to resize the element, which may be resized both horizontally and vertically.
  • horizontalThe element displays a mechanism for allowing the user to resize the element, which may only be resized horizontally.
  • verticalThe element displays a mechanism for allowing the user to resize the element, which may only be resized vertically.
  • inherit

Example

<div class="examples">
<h2>CSS resize examples</h2>

<div class="example">
<label>resize: both</label>
<div class="box resizable-both" tabindex="0">Resize both ways</div>
</div>

<div class="example">
<label>resize: horizontal</label>
<div class="box resizable-horizontal" tabindex="0">Resize horizontally</div>
</div>

<div class="example">
<label>resize: vertical</label>
<div class="box resizable-vertical" tabindex="0">Resize vertically</div>
</div>

<div class="example">
<label>resize: none</label>
<div class="box not-resizable" tabindex="0">Not resizable</div>
</div>

<div class="example">
<label>textarea (resize: vertical)</label>
<textarea class="textarea-vertical">Try resizing me vertically</textarea>
</div>
</div>
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  padding: 24px;
  background: #f7f7f9;
  color: #111;
}

.examples {
  max-width: 720px;
  margin: 0 auto;
}

h2 {
  margin: 0 0 16px 0;
  font-size: 18px;
}

.example {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
}

.box {
  width: 260px;
  height: 120px;
  padding: 12px;
  border: 1px solid #ccc;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: auto; /* required for resize to work on non-textarea elements */
  resize: both;
}

.resizable-both {
  resize: both;
}

.resizable-horizontal {
  resize: horizontal;
}

.resizable-vertical {
  resize: vertical;
}

.not-resizable {
  resize: none;
  cursor: default;
}

.textarea-vertical {
  width: 100%;
  min-width: 200px;
  max-width: 100%;
  height: 80px;
  padding: 8px;
  border: 1px solid #ccc;
  resize: vertical;
  font-family: inherit;
}

Browser Support

The following information will show you the current browser support for the CSS resize property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!