「及時」模式:全新世代的 Tailwind CSS
Tailwind CSS on GitHub

Resize

Utilities for controlling how an element can be resized.

Default class reference

Class
屬性
resize-noneresize: none;
resize-yresize: vertical;
resize-xresize: horizontal;
resizeresize: both;

Resize in all directions

Use resize to make an element horizontally and vertically resizable.

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

Resize vertically

Use resize-y to make an element vertically resizable.

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

Resize horizontally

Use resize-x to make an element horizontally resizable.

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

Prevent resizing

Use resize-none to prevent an element from being resizable.

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

Customizing

Variants

默認情況下, 只有 響應式 的 resizing 變化模式 (variants) 會產生。

tailwind.config.jsvariants 區塊中變更 resize 屬性來決定有哪些變化模式會生成。

舉個例子來說,這個設定將會生成 響應式 和 hover 的變化模式。

  // tailwind.config.js
  module.exports = {
    variants: {
      extend: {
        // ...
+       resize: ['responsive', 'hover'],
      }
    }
  }

Disabling

如果你不打算在專案中使用 resizing 功能,可以在你的設定檔裡的 corePlugins 屬性中將 resize 設定為 false 來停用功能:

  // tailwind.config.js
  module.exports = {
    corePlugins: {
      // ...
+     resize: false,
    }
  }