用于缩放元素的功能类。
<img class="transform scale-75 ...">
<img class="transform scale-100 ...">
<img class="transform scale-125 ...">
<img class="transform scale-150 ...">
To control the scale of an element at a specific breakpoint, add a {screen}:
prefix to any existing scale utility. For example, use md:scale-75
to apply the scale-75
utility at only medium screen sizes and above. —>
要在特定的断点处控制元素的比例,请在任何现有的缩放功能类中添加 {screen}:
前缀。例如,使用 md:scale-75
来应用 scale-75
功能类,只适用于中等尺寸以上的屏幕。
<div class="transform scale-100 md:scale-75"></div>
关于 Tailwind 的响应式设计功能的更多信息,请查看响应式设计文档。
By default, Tailwind provides ten general purpose scale utilities. You change, add, or remove these by editing the theme.scale
section of your Tailwind config.
// 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
属性设置为 false
来完全禁用它们:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ scale: false,
}
}