弹性盒子与网格
控制 flex 项目换行的工具类。
Class | Styles |
---|---|
flex-nowrap | flex-wrap: nowrap; |
flex-wrap | flex-wrap: wrap; |
flex-wrap-reverse | flex-wrap: wrap-reverse; |
使用 flex-nowrap
来防止 flex 项目换行,如果必要,导致不灵活的项目溢出容器:
<div class="flex flex-nowrap"> <div>01</div> <div>02</div> <div>03</div></div>
使用 flex-wrap
允许 flex 项目换行:
<div class="flex flex-wrap"> <div>01</div> <div>02</div> <div>03</div></div>
使用 flex-wrap-reverse
在反向方向上换行 flex 项目:
<div class="flex flex-wrap-reverse"> <div>01</div> <div>02</div> <div>03</div></div>
Prefix a flex-wrap
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<div class="flex flex-wrap md:flex-wrap-reverse ..."> <!-- ... --></div>
Learn more about using variants in the variants documentation.