
弹性盒 & 网格
用于控制 flex 和 grid 项目顺序的工具。
使用 order-* 工具可以将 flex 和 grid 项目的显示顺序与它们在 DOM 中出现的顺序不同。
🌐 Use the order-* utilities to render flex and grid items in a different order than they appear in the DOM.
<div class="flex justify-between ...">
<div class="order-last">01</div>
<div>02</div>
<div>03</div>
</div>
要使用负的顺序值,在类名之前加上减号即可将其转换为负值。
🌐 To use a negative order value, prefix the class name with a dash to convert it to a negative value.
<div class="-order-1">
<!-- ... -->
</div>
Tailwind 允许你使用变体修饰符在不同状态下有条件地应用工具类。例如,使用hover:order-last 仅在 hover 时应用 order-last 工具。
<div class="order-first hover:order-last">
<!-- ... -->
</div>
有关所有可用状态修饰符的完整列表,请查看悬停、聚焦、以及其他状态 文档。
你还可以使用变体修饰符来定位媒体查询,例如响应式断点、暗黑模式、首选减少运动等。例如,使用 md:order-last 仅在中等屏幕尺寸及以上时应用 order-last 工具。
<div class="order-first md:order-last">
<!-- ... -->
</div>
要了解更多信息,请查看有关 响应式设计、暗黑模式、以及 其他媒体查询修饰符 的文档。
默认情况下,Tailwind 提供 order-first、order-last、order-none 以及从 1 到 12 的编号工具类。你可以通过编辑 tailwind.config.js 文件中的 theme.order 或 theme.extend.order 来自定义这些值。
🌐 By default, Tailwind provides utilities for order-first, order-last, order-none, and numbered utilities from 1 through 12. You can customize these values by editing theme.order or theme.extend.order in your tailwind.config.js file.
module.exports = {
theme: {
extend: {
order: {
'13': '13'
}
}
}
}
在主题自定义文档中了解有关自定义默认主题的更多信息。
🌐 Learn more about customizing the default theme in the theme customization documentation.
如果你需要使用一次性的 order 值,而该值没有必要包含在你的主题中,请使用方括号动态生成属性,使用任意值。
<div class="order-[13]">
<!-- ... -->
</div>
在 任意值 文档中了解有关任意值支持的更多信息。