1. 弹性盒与网格
  2. flex-direction(弹性方向)

弹性盒与网格

flex-direction

用于控制弹性项目方向的工具类。

ClassStyles
flex-row
flex-direction: row;
flex-row-reverse
flex-direction: row-reverse;
flex-col
flex-direction: column;
flex-col-reverse
flex-direction: column-reverse;

示例

行方向

使用 flex-row 将弹性项目水平排列,方向与文本方向相同:

01
02
03
<div class="flex flex-row ...">  <div>01</div>  <div>02</div>  <div>03</div></div>

行反向排列

使用 flex-row-reverse 将弹性项目水平反向排列:

01
02
03
<div class="flex flex-row-reverse ...">  <div>01</div>  <div>02</div>  <div>03</div></div>

列排列

使用 flex-col 将弹性项目垂直排列:

01
02
03
<div class="flex flex-col ...">  <div>01</div>  <div>02</div>  <div>03</div></div>

列反向排列

使用 flex-col-reverse 将弹性项目在垂直方向上反向排列:

01
02
03
<div class="flex flex-col-reverse ...">  <div>01</div>  <div>02</div>  <div>03</div></div>

响应式设计

Prefix a flex-direction utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<div class="flex flex-col md:flex-row ...">  <!-- ... --></div>

Learn more about using variants in the variants documentation.

Copyright © 2025 Tailwind Labs Inc.·Trademark Policy