用于缩放元素的功能类。
<img class="transform scale-75 ...">
<img class="transform scale-100 ...">
<img class="transform scale-125 ...">
<img class="transform scale-150 ...">请注意,因为 Tailwind 使用 CSS 自定义属性来实现变换,变换功能不支持旧的浏览器,如 IE11。如果您的项目需要变换,并且需要支持旧的浏览器,添加您自己的功能类或其他自定义 CSS。
要在特定的断点处控制元素的比例,请在任何现有的缩放功能类中添加 {screen}: 前缀。例如,使用 md:scale-75 来应用 scale-75 功能类,只适用于中等尺寸以上的屏幕。
<div class="transform scale-100 md:scale-75"></div>关于 Tailwind 的响应式设计功能的更多信息,请查看响应式设计文档。
默认情况下,Tailwind 提供了 10 个通用的 scale 功能类。您可以通过编辑您的 Tailwind 配置的 theme.scale 部分来改变,添加或删除这些功能类。
  // tailwind.config.js
  module.exports = {
    theme: {
      scale: {
        '0': '0',
+       '25': '.25',
        '50': '.5',
        '75': '.75',
        '90': '.9',
-       '95': '.95',
        '100': '1',
-       '105': '1.05',
-       '110': '1.1',
        '125': '1.25',
        '150': '1.5',
+       '200': '2',
      }
    }
  }在主题定制文档中了解更多关于定制默认主题的信息。
默认情况下, 针对 scale 功能类,只生成 responsive, hover and focus 变体。
您可以通过修改您的 tailwind.config.js 文件中的 variants 部分中的 scale 属性来控制为 scale 功能生成哪些变体。
例如,这个配置也将生成 active and group-hover 变体:
  // tailwind.config.js
  module.exports = {
    variants: {
      extend: {
        // ...
+       scale: ['active', 'group-hover'],
      }
    }
  }如果您不打算在您的项目中使用 scale 功能,您可以通过在配置文件的 corePlugins 部分将 scale property to false in the corePlugins section of your config file:
  // tailwind.config.js
  module.exports = {
    corePlugins: {
      // ...
+     scale: false,
    }
  }