Type and forms

field-sizing

Newly availablesince Jun 2026

Replaces: A script that resizes a textarea as you type. The field grows to fit its content.

See it working

The syntax

textarea { field-sizing: content; min-height: 3lh; max-height: 12lh; }
The demo’s full CSS
.dm-fs-t { field-sizing: content; width: 100%; box-sizing: border-box; min-height: 3lh; max-height: 10lh;
  font: inherit; font-size: 14px; line-height: 1.5; padding: 10px 12px;
  border: 1px solid #c9cdd8; border-radius: 10px; background: #fff; color: #1c1f2a; resize: none; }

For browsers without it

Without it the textarea stays at its min-height and scrolls, which is how every textarea has always worked. Give it a sensible rows attribute and you are done.