← All Tools

CSS field-sizing Generator

The CSS field-sizing property lets form controls — <textarea>, <input>, <select> — size themselves to their content instead of their UA-defined default box. Set field-sizing: content and a textarea grows as the user types, replacing the classic scrollHeight JavaScript hack. Build your rule below and watch a live preview.

Pick one element to demo, or apply globally to all form controls.
content sizes the control to fit text. fixed restores the UA default (rows/cols/size attributes). Flip back and forth to compare.
min-width
max-width
min-height
max-height
Without bounds, controls can shrink to one character or grow off-screen. ch and lh units track the form control's own font.
@supports (field-sizing: content) isolates the rule so unsupported browsers fall back to their normal sizing.
Type in the preview directly too — your edits there feed back into this demo content.
Live previewchecking…
The configured CSS is applied inside an isolated iframe. Try typing into the textarea, the input, and changing the select — only controls matching your selector follow the rule.
Generated CSS

    

Support: field-sizing shipped in Chrome 123 / Edge 123 (March 2024) and Safari 17.4. Firefox is implementing it behind a flag. Older browsers ignore the declaration and fall back to rows/cols/size attributes. Use @supports (field-sizing: content) to be safe.

Why this matters