# Field Sizing
Without field-sizing
, to create a content-sized input field you
had to either guess at an average size of a text field input or use
JavaScript to count characters and increase the element height or width as
the user entered text. Now it's a CSS one-liner.
textarea, select, input {
field-sizing: content;
}
The following video demonstrates how a textarea
, select
,
and input
can now shrink to fit the size of the placeholder or
content value.
The following demo offers a side by side comparison of how inputs behave
without field-sizing
and with field-sizing
.
This will work for any font, any font size, any language and any writing mode. What used to be high effort will now be low effort.
Adam Argyle