field-sizing: content
Baseline 2026 (Chrome 123, Safari 26.2, Firefox 152 in June 2026).
Chrome 123
Edge 123
Safari 26.2
Firefox 152
Makes inputs, textareas and selects size themselves to their content, so a textarea grows as the user types and an input is as wide as its value. Kills the auto-grow textarea JS snippet.
CSS
.fx-031 {
font-family: system-ui;
display: grid;
gap: 4px;
max-width: 400px
}
.fx-031 textarea {
field-sizing: content;
min-height: 2lh;
max-height: 12lh;
padding: 8px;
border: 1px solid #bbb;
border-radius: 8px;
resize: none
}
.fx-031 :is(a,button,input,select,textarea):focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
HTML
<label class="fx-031">Notes <textarea rows="2" placeholder="Type to grow"></textarea></label>Fallback: Unsupported browsers keep the fixed `rows` height with a scrollbar.
Prompt
For auto-growing textareas and inputs use `field-sizing: content` with `min-height`/`max-height` in `lh` units for bounds; do not add input listeners that set `style.height`. Keep `rows`/`size` as the fallback size.