Skip to main content

Presets

Target Element

Resize Direction

Overflow (Required)

โš ๏ธResize requires overflow other than visible!

Size Constraints (Optional)

Interactive Demo

Try resizing the box below by dragging the bottom-right corner:

resize: bothoverflow: auto

Drag the corner to resize this element.

The resize handle appears in the bottom-right corner.

Value Comparison

โŠ˜none
Try to resize
โคกboth
Try to resize
โ†”horizontal
Try to resize
โ†•vertical
Try to resize

Generated CSS

textarea {
  resize: both;
  overflow: auto;
}

Full Example

/* CSS Resize Examples */

/* Basic resize values */
.resizable {
  resize: both;          /* Resize in any direction */
  overflow: auto;        /* Required for resize to work! */
}

.resize-horizontal {
  resize: horizontal;    /* Width only */
  overflow: auto;
}

.resize-vertical {
  resize: vertical;      /* Height only */
  overflow: auto;
}

.no-resize {
  resize: none;          /* Disable resize */
}

/* Logical resize (for internationalization) */
.resize-block {
  resize: block;         /* Block axis (vertical in LTR) */
  overflow: auto;
}

.resize-inline {
  resize: inline;        /* Inline axis (horizontal in LTR) */
  overflow: auto;
}

/* Standard textarea - resizable by default */
textarea {
  resize: vertical;      /* Usually best to limit to vertical */
  min-height: 100px;
  max-height: 400px;
  overflow: auto;
}

/* Disable textarea resize */
textarea.no-resize {
  resize: none;
}

/* Resizable sidebar/panel */
.sidebar {
  resize: horizontal;
  overflow: auto;
  min-width: 200px;
  max-width: 500px;
  width: 280px;
  height: 100%;
  border-right: 1px solid #ddd;
}

/* Resizable code editor area */
.code-editor {
  resize: vertical;
  overflow: auto;
  min-height: 150px;
  max-height: 80vh;
  font-family: monospace;
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1rem;
  border-radius: 8px;
}

/* Chat/message input */
.chat-input {
  resize: vertical;
  overflow: hidden;
  min-height: 40px;
  max-height: 200px;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 0.5rem 1rem;
}

/* Resizable modal/dialog */
.modal-resizable {
  resize: both;
  overflow: auto;
  min-width: 300px;
  min-height: 200px;
  max-width: 90vw;
  max-height: 90vh;
}

/* Resizable notes/sticky */
.sticky-note {
  resize: both;
  overflow: auto;
  min-width: 150px;
  min-height: 150px;
  max-width: 400px;
  max-height: 400px;
  background: #fff3cd;
  padding: 1rem;
  box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
}

/* Image container */
.image-preview {
  resize: both;
  overflow: hidden;
  min-width: 100px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Resizable columns layout */
.column-resizable {
  resize: horizontal;
  overflow: auto;
  min-width: 100px;
  flex-shrink: 0;
}

/* Terminal/console */
.terminal {
  resize: both;
  overflow: auto;
  min-width: 400px;
  min-height: 200px;
  background: #000;
  color: #0f0;
  font-family: monospace;
  padding: 1rem;
}

/* Form field group */
.field-group {
  resize: vertical;
  overflow: auto;
  min-height: 100px;
  max-height: 500px;
  border: 1px solid #ddd;
  padding: 1rem;
}

/* Split pane */
.split-pane-left,
.split-pane-right {
  resize: horizontal;
  overflow: auto;
  min-width: 200px;
  flex: 1;
}

/* Cards grid container */
.cards-container {
  resize: both;
  overflow: auto;
  min-width: 300px;
  min-height: 200px;
}

/* Styling the resize handle (WebKit only) */
.custom-handle::-webkit-resizer {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 4px;
}

/* Hide resize handle but keep functionality */
.subtle-resize {
  resize: both;
  overflow: auto;
}

.subtle-resize::-webkit-resizer {
  background: transparent;
}

/* Resize with custom cursor */
.resizable-cursor {
  resize: both;
  overflow: auto;
  cursor: nwse-resize;
}

/* Responsive resize limits */
@media (max-width: 768px) {
  .sidebar {
    resize: none;        /* Disable on mobile */
  }

  textarea {
    resize: vertical;    /* Only vertical on mobile */
    max-height: 200px;
  }
}

/* Print - disable resize */
@media print {
  * {
    resize: none !important;
  }
}

/* Focus state enhancement */
.resizable:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Resizable with visible handle */
.resizable-visible {
  resize: both;
  overflow: auto;
  position: relative;
}

.resizable-visible::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  background: linear-gradient(
    135deg,
    transparent 50%,
    #ccc 50%,
    #ccc 60%,
    transparent 60%,
    transparent 70%,
    #ccc 70%,
    #ccc 80%,
    transparent 80%
  );
  pointer-events: none;
}

/* Accessibility - resize indicator */
.resizable[aria-label]::before {
  content: attr(aria-label);
  position: absolute;
  bottom: 4px;
  right: 24px;
  font-size: 10px;
  color: #999;
  opacity: 0;
  transition: opacity 0.2s;
}

.resizable[aria-label]:hover::before {
  opacity: 1;
}

Reference

Resize Values

ValueDirectionDescription
none-Element cannot be resized (default for most elements)
bothโ†” โ†•Resize horizontally and vertically
horizontalโ†”Resize width only
verticalโ†•Resize height only
blockBlock axisResize in block direction (vertical in horizontal writing mode)
inlineInline axisResize in inline direction (horizontal in horizontal writing mode)

Important: Overflow Requirement

The resize property only works when overflow is set to something other than visible (the default). Use auto,hidden, or scroll.

.resizable {
  resize: both;
  overflow: auto;  /* Required! */
}

Browser Support

  • Chrome: 1+ (full support)
  • Firefox: 4+ (full support)
  • Safari: 3+ (full support)
  • Edge: 79+ (full support)
  • IE: Not supported

Note: block and inline values have more limited support.

Common Use Cases

  • Textareas: Allow users to expand input areas
  • Sidebars/Panels: Adjustable width navigation or tool panels
  • Code editors: Expandable code input areas
  • Chat inputs: Expandable message composition
  • Modals/Dialogs: Resizable popup windows
  • Split panes: Adjustable layout columns
  • Image previews: Resizable preview containers

Best Practices

  • Always set overflow to auto or hidden
  • Define min-width/min-height to prevent elements from becoming too small
  • Set max-width/max-height to prevent layout breaking
  • For textareas, vertical resize is often better than both
  • Consider disabling resize on mobile devices
  • Provide visual feedback for the resize handle area
  • Test resize behavior with actual content inside the element

Styling the Resize Handle

WebKit browsers support styling the resize handle:

::-webkit-resizer {
  background: #667eea;
  border-radius: 4px;
}

Note: This is a non-standard feature and may not work in all browsers.

Rate this tool