弹性盒子与网格
用于控制单个项目在同一时间如何被对齐和定位的工具类。
Class | Styles |
---|---|
place-self-auto | place-self: auto; |
place-self-start | place-self: start; |
place-self-end | place-self: end; |
place-self-center | place-self: center; |
place-self-stretch | place-self: stretch; |
使用 place-self-auto
根据容器的 place-items
属性的值对齐项目:
<div class="grid grid-cols-3 gap-4 ..."> <div>01</div> <div class="place-self-auto ...">02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div></div>
使用 place-self-start
将项目在两个轴上对齐到开始位置:
<div class="grid grid-cols-3 gap-4 ..."> <div>01</div> <div class="place-self-start ...">02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div></div>
使用 place-self-center
将项目在两个轴上对齐到中心位置:
<div class="grid grid-cols-3 gap-4 ..."> <div>01</div> <div class="place-self-center ...">02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div></div>
使用 place-self-end
将项目在两个轴上对齐到结束位置:
<div class="grid grid-cols-3 gap-4 ..."> <div>01</div> <div class="place-self-end ...">02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div></div>
使用 place-self-stretch
在两个轴上拉伸项目:
<div class="grid grid-cols-3 gap-4 ..."> <div>01</div> <div class="place-self-stretch ...">02</div> <div>03</div> <div>04</div> <div>05</div> <div>06</div></div>
Prefix a place-self
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<div class="place-self-start md:place-self-end ..."> <!-- ... --></div>
Learn more about using variants in the variants documentation.