
弹性盒 & 网格
用于控制弹性子项换行的工具。
使用 flex-nowrap 防止弹性子项换行,如果必要的话,会导致不灵活的子项溢出容器:
🌐 Use flex-nowrap to prevent flex items from wrapping, causing inflexible items to overflow the container if necessary:
<div class="flex flex-nowrap">
<div>01</div>
<div>02</div>
<div>03</div>
</div>
使用 flex-wrap 允许弹性项目换行:
🌐 Use flex-wrap to allow flex items to wrap:
<div class="flex flex-wrap">
<div>01</div>
<div>02</div>
<div>03</div>
</div>
使用 flex-wrap-reverse 以相反方向封装弹性项目:
🌐 Use flex-wrap-reverse to wrap flex items in the reverse direction:
<div class="flex flex-wrap-reverse">
<div>01</div>
<div>02</div>
<div>03</div>
</div>
Tailwind 允许你使用变体修饰符在不同状态下有条件地应用工具类。例如,使用hover:flex-wrap-reverse 仅在 hover 时应用 flex-wrap-reverse 工具。
<div class="flex flex-wrap hover:flex-wrap-reverse">
<!-- ... -->
</div>
有关所有可用状态修饰符的完整列表,请查看悬停、聚焦、以及其他状态 文档。
你还可以使用变体修饰符来定位媒体查询,例如响应式断点、暗黑模式、首选减少运动等。例如,使用 md:flex-wrap-reverse 仅在中等屏幕尺寸及以上时应用 flex-wrap-reverse 工具。
<div class="flex flex-wrap md:flex-wrap-reverse">
<!-- ... -->
</div>