1. Interactivity
  2. resize

Interactivity

resize

用于控制元素可缩放方式的工具类。

ClassStyles
resize-none
resize: none;
resize
resize: both;
resize-y
resize: vertical;
resize-x
resize: horizontal;

示例

在任意方向上缩放

使用 resize 让元素同时可以横向和纵向缩放:

Drag the textarea handle in the demo to see the expected behavior

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

仅纵向缩放

使用 resize-y 让元素只能进行纵向缩放:

Drag the textarea handle in the demo to see the expected behavior

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

仅横向缩放

使用 resize-x 让元素只能进行横向缩放:

Drag the textarea handle in the demo to see the expected behavior

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

禁止缩放

使用 resize-none 来禁止元素缩放:

Notice that the textarea handle is gone

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

响应式设计

Prefix a resize utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

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

Learn more about using variants in the variants documentation.

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