1. 互动性
  2. resize

互动性

resize

用于控制如何调整元素大小的工具。

样式
resize-none
resize: none;
resize
resize: both;
resize-y
resize: vertical;
resize-x
resize: horizontal;

示例(Examples)

¥Examples

全方位调整大小(Resizing in all directions)

¥Resizing in all directions

使用 resize 使元素水平和垂直可调整大小:

¥Use resize to make an element horizontally and vertically resizable:

拖动演示中的文本区域句柄以查看预期行为

<textarea class="resize rounded-md ..."></textarea>

垂直调整大小(Resizing vertically)

¥Resizing vertically

使用 resize-y 使元素垂直可调整大小:

¥Use resize-y to make an element vertically resizable:

拖动演示中的文本区域句柄以查看预期行为

<textarea class="resize-y rounded-md ..."></textarea>

水平调整大小(Resizing horizontally)

¥Resizing horizontally

使用 resize-x 使元素水平可调整大小:

¥Use resize-x to make an element horizontally resizable:

拖动演示中的文本区域句柄以查看预期行为

<textarea class="resize-x rounded-md ..."></textarea>

防止调整大小(Prevent resizing)

¥Prevent resizing

使用 resize-none 防止元素可调整大小:

¥Use resize-none to prevent an element from being resizable:

请注意,textarea 句柄已消失

<textarea class="resize-none rounded-md"></textarea>

响应式设计(Responsive design)

¥Responsive design

resize 工具前面使用断点变体如 md: 仅在 medium 屏幕尺寸及以上时应用工具:

<div class="resize-none md:resize ...">
<!-- ... -->
</div>

请参阅 变体文档 详细了解如何使用变体。

TailwindCSS v4.1 中文网 - 粤ICP备13048890号