CKTIS / CSS
field-sizing — content-based control sizing
The field-sizing property switches form controls between their default preferred size and content-based sizing. It does not replace dimensional constraints.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
field-sizing: fixed | content;field-sizing applies to elements with a default preferred size, such as textarea. Its initial value, fixed, preserves that size; it does not mean locking dimensions in pixels.
content determines intrinsic size from content, ignoring the default preferred size. With a fixed width, a textarea can adjust its height to its line count. Explicit dimensions and minimum and maximum constraints still matter.
The property is not inherited; animation is discrete. Its definition comes from a CSSWG draft. The example requires local verification rather than assumed browser compatibility.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>field-sizing</title>
<style>
textarea {
display: block;
width: 16em;
font: 16px/1.5 monospace;
}
#content {
field-sizing: content;
}
#fixed {
field-sizing: fixed;
}
</style>
<label for="content">content</label>
<textarea id="content">One
Two
Three
Four</textarea>
<label for="fixed">fixed</label>
<textarea id="fixed">One
Two
Three
Four</textarea>
</html>Result
Expected in a supporting browser: the content textarea fits its four lines vertically; the fixed textarea retains its default preferred height. Adding or deleting lines changes the content textarea's height, but not the fixed textarea's height.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.