弹性盒子与网格
控制 flex 和 grid 项在容器交叉轴上定位的工具类。
Class | Styles |
---|---|
items-start | align-items: flex-start; |
items-end | align-items: flex-end; |
items-center | align-items: center; |
items-baseline | align-items: baseline; |
items-stretch | align-items: stretch; |
使用 items-stretch
将项目拉伸以填充容器的交叉轴:
<div class="flex items-stretch ..."> <div class="py-4">01</div> <div class="py-12">02</div> <div class="py-8">03</div></div>
使用 items-start
将项目对齐到容器的交叉轴的起始位置:
<div class="flex items-start ..."> <div class="py-4">01</div> <div class="py-12">02</div> <div class="py-8">03</div></div>
使用 items-center
将项目沿容器的交叉轴居中对齐:
<div class="flex items-center ..."> <div class="py-4">01</div> <div class="py-12">02</div> <div class="py-8">03</div></div>
使用 items-end
将项目对齐到容器的交叉轴的结束位置:
<div class="flex items-end ..."> <div class="py-4">01</div> <div class="py-12">02</div> <div class="py-8">03</div></div>
使用 items-baseline
将项目沿容器的交叉轴对齐,使它们的基线保持一致:
<div class="flex items-baseline ..."> <div class="pt-2 pb-6">01</div> <div class="pt-8 pb-12">02</div> <div class="pt-12 pb-4">03</div></div>
Prefix an align-items
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<div class="flex items-stretch md:items-center ..."> <!-- ... --></div>
Learn more about using variants in the variants documentation.