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; }
Edit the demo’s CSS

This is the stylesheet running the demo above. Change a value and watch it. Break it on purpose: delete the modern line and you are looking at the fallback.

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.

Before you ship it

The size attribute stops working

On an input with field-sizing: content, the HTML size attribute has no effect. Constrain the field with min-width and max-width instead, or a long value will stretch the layout. Source