How many times have you attached a JS handler to input and recalculated scrollHeight just to make a chat or comment box grow with its text? Or built a hack with a hidden clone inside a CSS Grid? Now the field-sizing property from the CSS Forms Module Level 1 draft handles this directly.
textarea {
/* Resize the field to fit its text */
field-sizing: content;
/* Lock the width so it grows downward */
inline-size: 100%;
/* Set minimum and maximum height */
min-block-size: 4rem;
max-block-size: 10rem;
/* Enable scrolling past 10rem */
overflow: auto;
}
The logical inline-size property sets the width, while min-block-size and max-block-size define the height range. Without a width limit, an empty <textarea> shrinks down to a text caret. Also, a fixed height from a CSS reset will override auto-growth. While text is short, the box stays at 4rem, then expands up to 10rem and switches to scrolling.
According to MDN and Can I use, the property reached Baseline Newly Available on June 16, 2026. It works in Chrome 123+, Edge 123+, Safari 26.2+, and Firefox 152+. With field-sizing: content, browsers ignore rows and cols, so you can keep them in HTML as a fallback. Older browsers simply ignore the new property and show a standard scrollable field.


