1. 交互性
  2. 字段大小调整

交互性

字段大小调整

用于控制表单控件大小的实用工具。

样式
field-sizing-fixed
field-sizing: fixed;
field-sizing-content
field-sizing: content;

示例

基于内容的大小调整

使用 field-sizing-content 实用工具,允许表单控件根据内容调整其大小

在下面的输入框中输入内容,查看大小变化

<textarea class="field-sizing-content ..." rows="2">  Latex Salesman, Vanderlay Industries</textarea>

使用固定大小

使用 field-sizing-fixed 实用工具,使表单控件使用固定大小

在下面的输入框中输入内容,查看大小保持不变

<textarea class="field-sizing-fixed w-80 ..." rows="2">  Latex Salesman, Vanderlay Industries</textarea>

响应式设计

前缀a field-sizing 实用工具 带有诸如 md: 的断点变体,仅在中等 屏幕尺寸及以上应用该实用工具

<input class="field-sizing-content md:field-sizing-fixed ..." />

了解有关在变体文档中使用变体的更多信息。

版权所有 © 2025 Tailwind Labs Inc.·商标政策