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:,仅在 带有断点变体的 field-sizing 实用工具,例如 md:,仅在中等 及以上屏幕尺寸应用该实用工具

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

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

Copyright © 2025 Tailwind Labs Inc.·Trademark Policy