用来控制 flex 项目排列顺序的功能类
<div class="flex justify-between ...">
<div class="order-last">1</div>
<div>2</div>
<div>3</div>
</div>要仅在特定断点处应用一个 flex 方向功能类,请在任何现有的功能类前添加 {screen}: 前缀。例如,使用 md:flex-row 仅在中等及以上尺寸屏幕上应用 flex-row 功能。
<div class="flex">
<div>1</div>
<div class="order-first md:order-last">2</div>
<div>3</div>
</div>关于 Tailwind 的响应式设计功能的更多信息,请查看 响应式设计 文档。
默认情况下,Tailwind 为 order-first、 order-last、 order-none、 和 order-{number} 提供了数字 1 到 12 的功能类。您可以通过编辑您的 tailwind.config.js 文件中的 theme.order 部分来更改、添加或删除这些功能类。
// tailwind.config.js
module.exports = {
theme: {
order: {
first: '-9999',
last: '9999',
- none: '0',
+ normal: '0',
'1': '1',
'2': '2',
'3': '3',
'4': '4',
'5': '5',
'6': '6',
- '7': '7',
- '8': '8',
- '9': '9',
- '10': '10',
- '11': '11',
- '12': '12',
}
}
}默认情况下, 针对 order 功能类,只生成 responsive 变体。
您可以通过修改您的 tailwind.config.js 文件中的 variants 部分中的 order 属性来控制为 order 功能生成哪些变体。
例如,这个配置也将生成 hover and focus 变体:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ order: ['hover', 'focus'],
}
}
}如果您不打算在您的项目中使用 order 功能,您可以通过在配置文件的 corePlugins 部分将 order property to false in the corePlugins section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ order: false,
}
}