交叉軸

flexbox 中,交叉軸 (cross axis) 垂直於 主軸 (main axis) 執行。因此,如果你的 flex-direction 設定為 rowrow-reverse,那麼交叉軸會沿著列的方向執行。

The cross axis runs down the column

如果你的主軸是 columncolumn-reverse,那麼交叉軸會沿著行的方向執行。

The cross axis runs along the row.

在交叉軸上對專案進行對齊是透過 flex 容器上的 align-items 屬性或單個專案上的 align-self 屬性來實現的。對於多行 flex 容器,當交叉軸上有額外空間時,可以使用 align-content 來控制行的間距。