弹性盒 & 网格
用于控制网格项目如何沿其内联轴对齐的工具。
¥Basic usage
¥Start
使用 justify-items-start
将网格项目对齐其内联轴的起点:
¥Use justify-items-start
to justify grid items against the start of their inline axis:
<div class="grid justify-items-start ...">
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
</div>
¥End
使用 justify-items-end
将网格项目对齐其内联轴的末端:
¥Use justify-items-end
to justify grid items against the end of their inline axis:
<div class="grid justify-items-end ...">
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
</div>
¥Center
使用 justify-items-center
沿其内联轴对齐网格项:
¥Use justify-items-center
to justify grid items along their inline axis:
<div class="grid justify-items-center ...">
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
</div>
¥Stretch
使用 justify-items-stretch
沿其内联轴拉伸项目:
¥Use justify-items-stretch
to stretch items along their inline axis:
<div class="grid justify-items-stretch ...">
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
</div>
Tailwind 允许你使用变体修饰符在不同状态下有条件地应用工具类。例如,使用hover:justify-items-center
仅在 hover 时应用 justify-items-center
工具。
<div class="grid justify-items-start hover:justify-items-center">
<!-- ... -->
</div>
有关所有可用状态修饰符的完整列表,请查看悬停、聚焦、以及其他状态 文档。
你还可以使用变体修饰符来定位媒体查询,例如响应式断点、暗黑模式、首选减少运动等。例如,使用 md:justify-items-center
仅在中等屏幕尺寸及以上时应用 justify-items-center
工具。
<div class="grid justify-items-start md:justify-items-center">
<!-- ... -->
</div>